|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ListADT<E>
A List is an ordered collection of items.
Method Summary | |
---|---|
void |
add(E item)
Add item to the end of the List. |
void |
add(int pos,
E item)
Add item at position pos in the List, moving the items originally in positions pos through size() - 1one place to the right to make room. |
boolean |
contains(E item)
Return true iff item is in the List (i.e., there is an item x in the List such that x.equals(item)) |
E |
get(int pos)
Return the item at position pos in the List. |
boolean |
isEmpty()
Return true iff the List is empty. |
E |
remove(int pos)
Remove and return the item at position pos in the List, moving the items originally in positions pos+1 through size() - 1one place to the left to fill in the gap. |
int |
size()
Return the number of items in the List. |
Method Detail |
---|
void add(E item)
item
- the item to addvoid add(int pos, E item)
pos
- the position at which to add the itemitem
- the item to add
java.lang.IndexOutOfBoundsException
- if pos is less than 0 or greater
than size()boolean contains(E item)
item
- the item to check
int size()
boolean isEmpty()
E get(int pos)
pos
- the position of the item to return
java.lang.IndexOutOfBoundsException
- if pos is less than 0 or greater than
or equal to size()E remove(int pos)
pos
- the position at which to remove the item
java.lang.IndexOutOfBoundsException
- if pos is less than 0 or greater than
or equal to size()
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |