| Modifier and Type | Field and Description |
|---|---|
protected java.lang.Object[] |
elements |
| Constructor and Description |
|---|
ArrayList()
Constructor.
|
ArrayList(DataStructure data)
Constructor.
|
ArrayList(int initialCapacity)
Constructor.
|
ArrayList(int initialCapacity,
int capacityIncrement)
Constructor.
|
ArrayList(Iterator it)
Constructor.
|
ArrayList(java.lang.Object[] data)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(int index,
java.lang.Object obj) |
boolean |
add(java.lang.Object obj)
Adds a new object to this data structure.
|
void |
add(java.lang.Object[] src,
int srcPos,
int destPos,
int len) |
void |
arrayCopy(int srcPos,
java.lang.Object[] dest,
int destPos,
int len) |
void |
clear()
Clears this data structure by removing all content from it.
|
boolean |
contains(java.lang.Object obj)
Checks whether
obj (or another instance equal to obj in terms of
java.lang.Object.equals(Object) ) is already present within this data structure
instance and returns true only if this is the case. |
java.lang.Object |
get(int index) |
int |
indexOf(java.lang.Object o) |
int |
lastIndexOf(java.lang.Object o) |
java.lang.Object |
remove(int index) |
boolean |
remove(java.lang.Object o)
Removes
obj from this data structure. |
boolean |
removeAll(DataStructure data)
Optimizing ArrayList.removeAll (see http://ahmadsoft.org/articles/removeall/index.html)
|
java.lang.Object |
set(int index,
java.lang.Object obj) |
java.lang.Object[] |
toArray()
Returns an array containing all items stored within this data structure.
|
java.lang.Object[] |
toArray(java.lang.Object[] array)
Stores all contained items into the passed-in array
objects. |
addAll, addAll, equals, getClassShortName, hashCode, iterator, listIterator, listIterator, size, subListcontainsAll, isEmpty, toStringpublic ArrayList()
public ArrayList(DataStructure data)
data - public ArrayList(java.lang.Object[] data)
data - public ArrayList(int initialCapacity)
initialCapacity - public ArrayList(int initialCapacity,
int capacityIncrement)
initialCapacity - capacityIncrement - public ArrayList(Iterator it)
it - public boolean add(java.lang.Object obj)
DataStructurepublic void add(java.lang.Object[] src,
int srcPos,
int destPos,
int len)
public void clear()
DataStructureclear in class DataStructurepublic boolean contains(java.lang.Object obj)
DataStructureobj (or another instance equal to obj in terms of
java.lang.Object.equals(Object) ) is already present within this data structure
instance and returns true only if this is the case.contains in class DataStructureobj - the object to check the presence oftrue if obj is contained by this instance, false if notpublic int lastIndexOf(java.lang.Object o)
lastIndexOf in class Listpublic boolean remove(java.lang.Object o)
DataStructureobj from this data structure. Returns true if obj
was actually present and thus it was really removed (i.e. this instance was modified by
the method call).remove in class DataStructureo - the object to removetrue only if obj was actually removedpublic boolean removeAll(DataStructure data)
public java.lang.Object[] toArray()
DataStructureDataStructure.size(), i.e. for an empty data structure an array of length zero is returned
(rather than null).toArray in class DataStructurenullpublic java.lang.Object[] toArray(java.lang.Object[] array)
DataStructureobjects. Returns the same
array.
The array is expected not to be null and to be of exactly DataStructure.size()
length. Otherwise, either a java.lang.NullPointerException or an
java.lang.IllegalArgumentException will be thrown.
toArray in class DataStructurearray - the array to store this data structure's content toobjects), however after having been filled with all
objects contained within this data structure instancepublic void arrayCopy(int srcPos,
java.lang.Object[] dest,
int destPos,
int len)