Use netbeans IDE program to write LinkedList class that implements ListADT inter
ID: 3864874 • Letter: U
Question
Use netbeans IDE program to write LinkedList class that implements ListADT interface. Use the provided SinglyLinkedNode class to store the animals and to create the links.
public interface ListADT<T> extends Iterable<T>
{
/**
* 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<T> iterator();
/**
* Returns a string representation of this list.
*
* @return a string representation of this list
*/
public String toString();
}
Explanation / Answer
You can take reference from following code:
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.