|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
A simple list interface. A list is an ordered collection of objects, which may contain duplicates.
Method Summary | |
void |
add(int index,
java.lang.Object o)
Add the given object at the given location, shifting elements as necessary. |
void |
addAll(SimpleList c)
Add the items in the given list to the end of the receiver. |
void |
addFirst(java.lang.Object o)
Add the given object to the front of the list. |
void |
addLast(java.lang.Object o)
Add the given object to the rear of the list. |
void |
clear()
Remove all elements. |
boolean |
contains(java.lang.Object o)
Answer true iff the given object is in the list. |
java.lang.Object |
get(int index)
Answer the element at the given location. |
java.lang.Object |
getFirst()
Answer the first element in the list. |
java.lang.Object |
getLast()
Answer the last element in the list. |
int |
indexOf(java.lang.Object o)
Answer the index of the first occurrence of the object in the list. |
boolean |
isEmpty()
Answer size() == 0 |
SimpleIterator |
iterator()
Answer an iterator over the elements of the list. |
java.lang.Object |
remove(int i)
Remove the item at the given index, shifting elements as necessary. |
boolean |
remove(java.lang.Object o)
Remove the first occurrence of the given object. |
java.lang.Object |
removeFirst()
Remove the first element. |
java.lang.Object |
removeLast()
Remove the last element. |
java.lang.Object |
set(int index,
java.lang.Object o)
Replace the element at the given location. |
int |
size()
Answer the number of elements in the collection. |
Method Detail |
public void add(int index, java.lang.Object o)
index
- must be >= 0 && <= lengthpublic void addAll(SimpleList c)
public void addFirst(java.lang.Object o)
public void addLast(java.lang.Object o)
public void clear()
public boolean contains(java.lang.Object o)
public java.lang.Object get(int index)
index
- must be >= 0 && < lengthpublic java.lang.Object getFirst()
public java.lang.Object getLast()
public int indexOf(java.lang.Object o)
public boolean isEmpty()
public SimpleIterator iterator()
public java.lang.Object remove(int i)
public boolean remove(java.lang.Object o)
public java.lang.Object removeFirst()
public java.lang.Object removeLast()
public java.lang.Object set(int index, java.lang.Object o)
index
- must be >= 0 && < lengthpublic int size()
|
||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |