|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ListADT<E>
Method Summary | |
---|---|
void |
add(E item)
Adds a data item to the end of the List. |
void |
add(int pos,
E item)
Adds a data 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. |
boolean |
contains(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)) |
E |
get(int pos)
Returns the item at position pos in the List. |
boolean |
isEmpty()
Returns true iff the List is does not have any data items. |
E |
remove(int pos)
Removes and returns the item at position pos in the List, moving the items originally in positions pos+1 through size() - 1 one place to the left to fill in the gap. |
int |
size()
Returns the number of items in the List. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
void add(E item)
item
- the item to add
java.lang.IllegalArgumentException
- if item is nullvoid add(int pos, E item)
pos
- the position at which to add the itemitem
- the item to add
java.lang.IllegalArgumentException
- if item is null
java.lang.IndexOutOfBoundsException
- if pos is less than 0 or greater
than size()boolean contains(E item)
item
- the item to check
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()boolean isEmpty()
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()int size()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |