|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weiss.util.AbstractCollection | +--weiss.util.ArrayList
The ArrayList implements a growable array. Insertions are always done at the end.
Constructor Summary | |
ArrayList()
Construct an empty ArrayList. |
|
ArrayList(Collection other)
Construct an ArrayList with same items as another Collection. |
Method Summary | |
boolean |
add(java.lang.Object x)
Adds an item to this collection, at the end. |
void |
clear()
Change the size of this collection to zero. |
boolean |
contains(java.lang.Object x)
Tests if some item is in this collection. |
java.lang.Object |
get(int idx)
Returns the item at position idx. |
Iterator |
iterator()
Obtains an Iterator object used to traverse the collection. |
ListIterator |
listIterator(int idx)
Obtains a ListIterator object used to traverse the collection bidirectionally. |
java.lang.Object |
remove(int idx)
Removes an item from this collection. |
boolean |
remove(java.lang.Object x)
Removes an item from this collection. |
java.lang.Object |
set(int idx,
java.lang.Object newVal)
Changes the item at position idx. |
int |
size()
Returns the number of items in this collection. |
Methods inherited from class weiss.util.AbstractCollection |
equals, hashCode, isEmpty, toArray |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface weiss.util.Collection |
isEmpty, toArray |
Constructor Detail |
public ArrayList()
public ArrayList(Collection other)
Method Detail |
public int size()
size
in interface Collection
public java.lang.Object get(int idx)
get
in interface List
idx
- the index to search in.ArrayIndexOutOfBoundsException
- if index is out of range.public java.lang.Object set(int idx, java.lang.Object newVal)
set
in interface List
idx
- the index to change.newVal
- the new value.ArrayIndexOutOfBoundsException
- if index is out of range.public boolean contains(java.lang.Object x)
contains
in interface Collection
contains
in class AbstractCollection
x
- any object.public boolean add(java.lang.Object x)
add
in interface Collection
x
- any object.public boolean remove(java.lang.Object x)
remove
in interface Collection
remove
in class AbstractCollection
x
- any object.public java.lang.Object remove(int idx)
idx
- the index of the object.public void clear()
clear
in interface Collection
clear
in class AbstractCollection
public Iterator iterator()
iterator
in interface Collection
public ListIterator listIterator(int idx)
listIterator
in interface List
idx
- the index to start the iterator. Use size() to do complete
reverse traversal. Use 0 to do complete forward traversal.IndexOutOfBoundsException
- if idx is not between 0 and size(), inclusive.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |