ListADT - A List is a general container storing a contiguous collection of items that is position-oriented using zero-based indexing and where

ListADT - A List is a general container storing a...

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
Background image
Background image

You've reached the end of your free preview.

Want to read both pages?

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture