|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface List12
Abstract data type for a dynamically growing list. The Iterator returned by iterator() must support the remove() method.
Method Summary | |
---|---|
void |
add(java.lang.Object o)
Equivalent to addToBack. |
void |
addToBack(java.lang.Object o)
Adds the specified Object o, which may be null, to the back of the list (i.e., at the tail). |
void |
addToFront(java.lang.Object o)
Adds the specified Object o, which may be null, to the front of the list (i.e., at the head). |
void |
clear()
Removes all elements from the list. |
boolean |
contains(java.lang.Object o)
Returns whether the specified Object o is contained in the list. |
java.lang.Object |
get(int index)
Returns the element stored at location index, where index 0 is the element stored at the head of the list and size()-1 is the index of the element at the tail of the list. |
boolean |
remove(java.lang.Object o)
Removes the first occurrence (ordered from front to back, i.e., head to tail of the list) of the specified Object o from the list, if it exists. |
java.lang.Object |
removeBack()
Removes and returns the element at the back of the list. |
java.lang.Object |
removeFront()
Removes and returns the element at the front of the list. |
int |
size()
Returns the number of elements (null or otherwise) currently stored in the list. |
Methods inherited from interface java.lang.Iterable |
---|
iterator |
Method Detail |
---|
void addToFront(java.lang.Object o)
o
- the object to add to the list.void addToBack(java.lang.Object o)
o
- the object to add to the list.void add(java.lang.Object o)
o
- the object to add to the list.java.lang.Object removeFront() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if the list was empty.java.lang.Object removeBack() throws java.util.NoSuchElementException
java.util.NoSuchElementException
- if the list was empty.boolean remove(java.lang.Object o)
void clear()
java.lang.Object get(int index) throws java.lang.IndexOutOfBoundsException
index
- the index of the element to retrieve.
java.lang.IndexOutOfBoundsException
- if the index is invalid.int size()
boolean contains(java.lang.Object o)
o
- the object whose presence in the list should be determined.
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |