|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||
java.lang.Object
|
+--uwcse.collections.SimpleAbstractList
|
+--uwcse.collections.SimpleArrayList
An implementation of SimpleList, using a growable array of elements. The vector will grow as needed, but not shrink if many items are removed from it. Generally, this collection performs random access operations efficiently. Notably, adding to the front of the collection is inefficient, when compared to SimpleLinkedList.
| Constructor Summary | |
SimpleArrayList()
|
|
| Method Summary | |
void |
add(int index,
java.lang.Object o)
O(N) time. |
void |
addFirst(java.lang.Object o)
O(N) time. |
void |
addLast(java.lang.Object o)
O(1) time, average. |
void |
clear()
O(1) time. |
java.lang.Object |
get(int index)
O(1) time. |
SimpleIterator |
iterator()
Answer an iterator over the elements of the list. |
static void |
main(java.lang.String[] args)
|
java.lang.Object |
remove(int i)
O(N) time because the cost of shifting items. |
java.lang.Object |
removeFirst()
O(N) time because of the cost of shifting items. |
java.lang.Object |
removeLast()
O(1) time. |
java.lang.Object |
set(int index,
java.lang.Object o)
O(1) time. |
void |
shiftLeftInTo(int index)
Shift items to the left one space, into the given location. |
int |
size()
O(1) time. |
| Methods inherited from class uwcse.collections.SimpleAbstractList |
addAll, contains, getFirst, getLast, indexOf, isEmpty, remove, test, toString |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface uwcse.collections.SimpleList |
addAll, contains, getFirst, getLast, indexOf, isEmpty, remove |
| Constructor Detail |
public SimpleArrayList()
| Method Detail |
public void add(int index,
java.lang.Object o)
add in interface SimpleListadd in class SimpleAbstractListuwcse.collections.SimpleListindex - must be >= 0 && <= lengthpublic void addFirst(java.lang.Object o)
addFirst in interface SimpleListaddFirst in class SimpleAbstractListpublic void addLast(java.lang.Object o)
addLast in interface SimpleListaddLast in class SimpleAbstractListpublic void clear()
clear in interface SimpleListclear in class SimpleAbstractListpublic java.lang.Object get(int index)
get in interface SimpleListget in class SimpleAbstractListuwcse.collections.SimpleListindex - must be >= 0 && < lengthpublic SimpleIterator iterator()
SimpleListiterator in interface SimpleListiterator in class SimpleAbstractListpublic static void main(java.lang.String[] args)
public java.lang.Object remove(int i)
remove in interface SimpleListremove in class SimpleAbstractListpublic java.lang.Object removeFirst()
removeFirst in interface SimpleListremoveFirst in class SimpleAbstractListpublic java.lang.Object removeLast()
removeLast in interface SimpleListremoveLast in class SimpleAbstractList
public java.lang.Object set(int index,
java.lang.Object o)
set in interface SimpleListset in class SimpleAbstractListuwcse.collections.SimpleListindex - must be >= 0 && < lengthpublic void shiftLeftInTo(int index)
public int size()
size in interface SimpleListsize in class SimpleAbstractList
|
||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||