Question: Need help implementing this method. All the methods that are in the interface are already implemented. Need help with the last one in both classes

Need help implementing this method. All the methods that are in the interface are already implemented. Need help with the last one in both classes ArrayList and LinkedList  Need help implementing this method. All the methods that are in
the interface are already implemented. Need help with the last one in
both classes ArrayList and LinkedList 3. Consider a member method reverse() for

3. Consider a member method reverse() for the List ADT that returns a new List with the elements in reversed order. For example if a List L = {Bob, Mel, Ron, Jil, Ron}, then a call to L.reverse() will return a new list M = {Ron, Jil, Ron, Mel, Bob). The old list L is not affected. The prototype for the method is a follows: public List reverse() Add this method to the interface and implement for the ArrayList and LinkedList classes. The method returns an empty list if the list Lis empty @Override public List reverse() { 208 209 210 211 212 return null; 3 public interface List extends Iterable { public void add(E obj); public void add(int index, E obj); public boolean remove(E obj); public boolean remove(int index); public int removeAll(E obj); public E get(int index); public E set(int index, E obj); public E first(); public E last(); public int firstIndex(E obj); public int lastIndex(E obj); public int size(); public boolean is Empty(); public boolean contains(E obj); public void clear(); public int replaceAll (E e, E f); public List reverse(); 22 }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!