Question: Write LinkedList class that implements ListADT interface. Use the provided SinglyLinkedNode class to store the animals and to create the links. public interface ListADT extends

Write LinkedList class that implements ListADT interface. Use the provided SinglyLinkedNode class to store the animals and to create the links.

public interface ListADT extends Iterable { /** * Removes and returns the first element from this list. * * @return the first element from this list * @throws exceptions.EmptyCollectionException */ public T removeFirst() throws EmptyCollectionException;

/** * Removes and returns the last element from this list. * * @return the last element from this list */ public T removeLast() throws EmptyCollectionException;

/** * Removes and returns the specified element from this list. * * @param element the element to be removed from the list */ public T remove(T element) throws EmptyCollectionException, ElementNotFoundException;

/** * Returns a reference to the first element in this list. * * @return a reference to the first element in this list */ public T first() throws EmptyCollectionException;

/** * Returns a reference to the last element in this list. * * @return a reference to the last element in this list */ public T last() throws EmptyCollectionException;

/** * Returns true if this list contains the specified target element. * * @param target the target that is being sought in the list * @return true if the list contains this element */ public boolean contains(T target) throws EmptyCollectionException;

/** * Returns true if this list contains no elements. * * @return true if this list contains no elements */ public boolean isEmpty();

/** * Returns the number of elements in this list. * * @return the integer representation of number of elements in this list */ public int size();

/** * Returns an iterator for the elements in this list. * * @return an iterator over the elements in this list */ public Iterator iterator();

/** * Returns a string representation of this list. * * @return a string representation of this list */ public String toString(); }

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!