Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Write a paper summary on introduction to VICTIMOLOGY

Answered: 1 week ago