import java.util.Iterator;
// Interface: CS210ListADT
//
// License Information:
// This class is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation.
//
// This class is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
/**
* The CS210ListADT interface specifies the methods that
* a list should have, as identified by the students in CS210 on
* 10 October, 2008.
* Modified Oct. 11, 2009 - Nathan Sprague
* @author Pam Cutter
* @version October 14, 2008
*/
public interface CS210ListADT extends Iterable
{
/** Tests whether this is an empty list.
* @return true if the list is empty;
* false otherwise
*/
boolean isEmpty();
/** Returns the number of elements in the list.
*/
int size();
/** Gets the data value at the beginning of the list.
* Precondition: list is not empty
*/
T first();
/** Gets the data value at the end of the list.
* Precondition: list is not empty
*/
T last();
/** Tests whether the specified object is in the list or not.
* @return true if obj is in the list;
* false otherwise
*/
boolean contains(T obj);
/** Deletes the data value at the beginning of the list.
* Precondition: list is not empty
*/
T removeFirst();
/** Deletes the data value at the end of the list.
* Precondition: list is not empty
*/
T removeLast();
/** Deletes the given object from the list (if it is in the list).
* If there is more than one occurrence of obj in
* the list, the first is removed.
* @param obj the object to find and delete from the list
* @return true if the object was in the list and
* removed; false otherwise
*/
boolean remove(T obj);
/** Removes all data values from the list.
*/
void clear();
/** Returns an iterator that can step through this list.
*/
Iterator iterator();
/** Deletes all occurrences of objects in the specified
* list from this list.
* @param fromList list of elements to be removed
*/
void removeAll(CS210ListADT extends T> fromList);
/** Creates a string representation of the elements in the list.
* @return the string representation
*/
String toString();
}