The implementations of the methods addAll, removeAll, retainAll, retainAll, containsAll(), and toArray(T[]) are omitted in the MyList interface. Implement these methods. Use the template at https://liveexample.pearsoncmg.com/test/Exercise24_01_13e.txt to implement these methods this the code i have for the write your own code part import java.util.Iterator; interface MyList extends java.util.Collection { void add(int index, E e); boolean contains(Object e); E get(int index); int indexOf(Object e); int lastIndexOf(E e); E remove(int index); E set(int index, E e); void clear(); boolean isEmpty(); Iterator iterator(); boolean containsAll(java.util.Collection c); boolean addAll(java.util.Collection c); boolean removeAll(java.util.Collection c); boolean retainAll(java.util.Collection c); Object[] toArray(); T[] toArray(T[] a); int size(); } and its giving me this error Exercise24_01.java:248: error: class, interface, or enum expected }import java.util.Iterator;
import java.util.Iterator;
interface MyList<E> extends java.util.Collection<E> {
void add(int index, E e);
boolean contains(Object e);
E get(int index);
int indexOf(Object e);
int lastIndexOf(E e);
E remove(int index);
E set(int index, E e);
void clear();
boolean isEmpty();
Iterator<E> iterator();
boolean containsAll(java.util.Collection<?> c);
boolean addAll(java.util.Collection<? extends E> c);
boolean removeAll(java.util.Collection<?> c);
boolean retainAll(java.util.Collection<?> c);
Object[] toArray();
<T> T[] toArray(T[] a);
int size();
}
and its giving me this error Exercise24_01.java:248: error: class, interface, or enum expected }import java.util.Iterator;
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 2 images