Question: MyList.java contains MyList interface. The implementations of the default methods addAll, removeAll, retainAll, toArray(), and toArray(T[]) are omitted in the MyList interface. Please implement these
MyList.java contains MyList interface. The implementations of the default methods addAll, removeAll, retainAll, toArray(), and toArray(T[]) are omitted in the MyList interface. Please implement these methods. MyArrayList class implements MyList interface and inherits those default methods even though you dont implement them in MyArrayList.java file. Note that you can utilize other methods defined in the MyList interface to implement those methods. Since those methods should be implemented beforehand in MyList.java, the MyArrayList.java file should not be modified.
public default Object[] toArray(){
// Left as an assignment
//Returns an array containing all of the elements in this list.
}
@Override
public default
// Left as an assignment
// Returns an array containing all of the elements in this list; the returned array
// is the specified array.
.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
