100%(1)1 out of 1 people found this document helpful
This preview shows page 1 - 2 out of 2 pages.
/*** A List is a general container storing a contiguous collection of items,* that is position-oriented using zero-based indexing and where duplicates* are allowed. ListADT extends the Iterable interface so that Lists can* be used with for-each loops.*/import java.lang.Iterable;public interface ListADT<E> extends Iterable<E> {/*** Adds item to the end of the List.* * @param item the item to add* @throws IllegalArgumentException if item is null */void add(E item);/*** Adds item at position pos in the List, moving the items originally in * positions pos through size() - 1 one place to the right to make room.* * @param pos the position at which to add the item* @param item the item to add* @throws IllegalArgumentException if item is null * @throws IndexOutOfBoundsException if pos is less than 0 or greater * than size()*/void add(int pos, E item);/*** Returns true iff item is in the List (i.e., there is an item x in the List * such that x.equals(item))* * @param item the item to check