/* * * To change the template for this generated file go to * Window - Preferences - Java - Code Generation - Code and Comments */ package proj2; /** * Interface for unsorted lists. In an unsorted list,
* list elements will stay in the order in which they were added. * @author walser */ public interface LinkedList { /** * Appends the object x to the end of the list * @param x the element to be appended to this list * @return true */ public boolean add(T x); /** * Adds the object x after the idx element * @param x the element to be added to the list * @return true */ public boolean add(int idx, T x) /** * Returns the number of elements in this list * @return the number of elements in this list */ public int size(); /** * Returns the element with the specified position in this list * @param the element to be returned * @return the element at the specified position in this list */ public T get(T val); /** * Replaces the old element in this list with * the new object x * @param old element to replace * @param x the element to be stored * @return the previous value of the element */ public T set(T old, T x); /** * Returns an iterator of the elements in this list (in proper sequence). * This implementation returns listIterator(0). * @return an iterator of the elements in this list (in proper sequence). */ public ListIterator listIterator(); /** * Returns an iterator of the elements in this list (in proper sequence). * @param index index of the first element to be returned from the list * iterator (by a call to the next method). * @return a list iterator of the elements in this list (in proper * sequence), starting at the specified position in the list. */ public ListIterator listIterator(int index); /** * Removes the first occurence of an object from the list * @param x the element to be removed from this list * @return true if the object was in the list, false otherwise */ public boolean remove(T x); /** * Tests if this list has no elements. * * @return true if this list has no elements; * false otherwise. */ public boolean isEmpty(); /** * Returns true if this list contains the specified element. * * @param elem element whose presence in this List is to be tested. * @return true if the specified element is present; * false otherwise. */ public boolean contains(T elem); /** * Compares the specified object with this list for equality. */ public boolean equals(Object o); }