|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object | +--uwcse.collections.SimpleAbstractList
An abstract superclass for list implementations. Implements several of the basic operations in terms of operations that are left to concrete implementations
| Constructor Summary | |
SimpleAbstractList()
|
|
| Method Summary | |
abstract void |
add(int index,
java.lang.Object o)
Add the given object at the given location, shifting elements as necessary. |
void |
addAll(SimpleList c)
Iterates over the given collection, adding each item to the end of the receiver. |
abstract void |
addFirst(java.lang.Object o)
Add the given object to the front of the list. |
abstract void |
addLast(java.lang.Object o)
Add the given object to the rear of the list. |
abstract void |
clear()
Remove all elements. |
boolean |
contains(java.lang.Object o)
Answers indexOf(o) != -1 |
abstract java.lang.Object |
get(int index)
Answer the element at the given location. |
java.lang.Object |
getFirst()
Answers get(0) |
java.lang.Object |
getLast()
Answers get(size() - 1) |
int |
indexOf(java.lang.Object o)
Iterates over the items, answering the index of the first occurrence of o. |
boolean |
isEmpty()
Answer size() == 0 |
abstract SimpleIterator |
iterator()
Answer an iterator over the elements of the list. |
abstract java.lang.Object |
remove(int i)
Remove the item at the given index, shifting elements as necessary. |
boolean |
remove(java.lang.Object o)
Relies on indexOf(o) and remove(index). |
abstract java.lang.Object |
removeFirst()
Remove the first element. |
abstract java.lang.Object |
removeLast()
Remove the last element. |
abstract java.lang.Object |
set(int index,
java.lang.Object o)
Replace the element at the given location. |
abstract int |
size()
Answer the number of elements in the collection. |
static void |
test(SimpleList list)
A generalized test method which can be used by subclasses. |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public SimpleAbstractList()
| Method Detail |
public abstract void add(int index,
java.lang.Object o)
SimpleListadd in interface SimpleListuwcse.collections.SimpleListindex - must be >= 0 && <= lengthpublic void addAll(SimpleList c)
addAll in interface SimpleListpublic abstract void addFirst(java.lang.Object o)
SimpleListaddFirst in interface SimpleListpublic abstract void addLast(java.lang.Object o)
SimpleListaddLast in interface SimpleListpublic abstract void clear()
SimpleListclear in interface SimpleListpublic boolean contains(java.lang.Object o)
contains in interface SimpleListpublic abstract java.lang.Object get(int index)
SimpleListget in interface SimpleListuwcse.collections.SimpleListindex - must be >= 0 && < lengthpublic java.lang.Object getFirst()
getFirst in interface SimpleListpublic java.lang.Object getLast()
getLast in interface SimpleListpublic int indexOf(java.lang.Object o)
indexOf in interface SimpleListpublic boolean isEmpty()
SimpleListisEmpty in interface SimpleListpublic abstract SimpleIterator iterator()
SimpleListiterator in interface SimpleListpublic abstract java.lang.Object remove(int i)
SimpleListremove in interface SimpleListpublic boolean remove(java.lang.Object o)
remove in interface SimpleListuwcse.collections.SimpleListpublic abstract java.lang.Object removeFirst()
SimpleListremoveFirst in interface SimpleListpublic abstract java.lang.Object removeLast()
SimpleListremoveLast in interface SimpleList
public abstract java.lang.Object set(int index,
java.lang.Object o)
SimpleListset in interface SimpleListuwcse.collections.SimpleListindex - must be >= 0 && < lengthpublic abstract int size()
SimpleListsize in interface SimpleListpublic static void test(SimpleList list)
public java.lang.String toString()
toString in class java.lang.Object
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||