123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- /**
- * ListADT defines the interface to a general list collection. Specific
- * types of lists will extend this interface to complete the
- * set of necessary operations.
- * @author Dr. Lewis
- * @author Dr. Chase
- * @version 1.0, 08/13/08
- */
- import java.util.Iterator;
- public interface ListADT<T>
- {
- /**
- * Removes and returns the first element from this list.
- *
- * @return the first element from this list
- */
- public T removeFirst ();
- /**
- * Removes and returns the last element from this list.
- *
- * @return the last element from this list
- */
- public T removeLast ();
- /**
- * Removes and returns the specified element from this list.
- *
- * @param element the element to be removed from the list
- */
- public T remove (T element);
- /**
- * Returns a reference to the first element in this list.
- *
- * @return a reference to the first element in this list
- */
- public T first ();
- /**
- * Returns a reference to the last element in this list.
- *
- * @return a reference to the last element in this list
- */
- public T last ();
- /**
- * 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);
- /**
- * 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();
- }
|