class UnorderList
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
Use the following code to iterate through an array.
UnorderList list = new UnorderList(YourClass.class);
// add element here
YourClass[] arr = (YourClass []) list.toArray();
int size = list.arraySize();
for (int i=0; i < size; i++) {
YourClass obj = arr[i];
....
}
Note:
| Modifier and Type | Field and Description |
|---|---|
(package private) java.lang.Object[] |
cloneData
Clone copy of elementData return by toArray(true);
|
(package private) int |
cloneSize |
(package private) java.lang.Class |
componentType
Component Type of individual array element entry
|
(package private) java.lang.Object[] |
elementData
The array buffer into which the elements of the ArrayList are stored.
|
(package private) boolean |
isDirty |
(package private) int |
size
The size of the ArrayList (the number of elements it contains).
|
| Constructor and Description |
|---|
UnorderList()
Constructs an empty list.
|
UnorderList(java.lang.Class componentType)
Constructs an empty list.
|
UnorderList(int initialCapacity)
Constructs an empty list with the specified initial capacity.
|
UnorderList(int initialCapacity,
java.lang.Class componentType)
Constructs an empty list with the specified initial capacity.
|
| Modifier and Type | Method and Description |
|---|---|
(package private) void |
add(java.lang.Object o)
Appends the specified element to the end of this list.
|
(package private) boolean |
addUnique(java.lang.Object o)
Add Object into the list if it is not already exists.
|
(package private) int |
arraySize()
Returns the size of entry use in toArray() number of elements
in this list.
|
(package private) void |
clear()
Removes all of the elements from this list.
|
(package private) void |
clearMirror() |
protected java.lang.Object |
clone()
Returns a shallow copy of this ArrayList instance.
|
(package private) boolean |
contains(java.lang.Object o)
Returns true if this list contains the specified element.
|
(package private) java.lang.Object |
get(int index)
Returns the element at the specified position in this list.
|
(package private) java.lang.Class |
getComponentType() |
(package private) int |
indexOf(java.lang.Object o)
Searches for the last occurence of the given argument, testing
for equality using the equals method.
|
(package private) boolean |
isEmpty()
Tests if this list has no elements.
|
private void |
readObject(java.io.ObjectInputStream s)
Reconstitute the ArrayList instance from a stream (that is,
deserialize it).
|
(package private) void |
remove(int index)
Removes the element at the specified position in this list.
|
(package private) boolean |
remove(java.lang.Object o)
Removes the specified element in this list.
|
(package private) java.lang.Object |
removeLastElement()
Removes the element at the last position in this list.
|
(package private) void |
removeOrdered(int index)
Removes the element at the specified position in this list.
|
(package private) void |
set(int index,
java.lang.Object element)
Replaces the element at the specified position in this list with
the specified element.
|
(package private) void |
shift(java.lang.Object[] objs,
int idx) |
(package private) int |
size()
Returns the number of elements in this list.
|
(package private) java.lang.Object[] |
toArray()
Returns an array containing all of the elements in this list.
|
(package private) java.lang.Object[] |
toArray(boolean copy)
Returns an array containing all of the elements in this list.
|
(package private) java.lang.Object[] |
toArray(java.lang.Object startElement)
Returns an array containing elements starting from startElement
all of the elements in this list.
|
(package private) void |
toArrayAndClear(java.lang.Object[] objs) |
java.lang.String |
toString() |
(package private) void |
trimToSize()
Trims the capacity of this ArrayList instance to be the
list's current size.
|
private void |
writeObject(java.io.ObjectOutputStream s)
Save the state of the ArrayList instance to a stream (that
is, serialize it).
|
transient java.lang.Object[] elementData
transient java.lang.Object[] cloneData
transient int cloneSize
transient boolean isDirty
java.lang.Class componentType
int size
UnorderList(int initialCapacity,
java.lang.Class componentType)
initialCapacity - the initial capacity of the list.componentType - class type of element in the list.UnorderList(java.lang.Class componentType)
componentType - class type of element in the list.UnorderList(int initialCapacity)
initialCapacity - the initial capacity of the list.UnorderList()
final int size()
final int arraySize()
final boolean isEmpty()
final boolean contains(java.lang.Object o)
o - element whose presence in this List is to be tested.final boolean addUnique(java.lang.Object o)
o - an object to add into the listfinal int indexOf(java.lang.Object o)
o - an object.Object.equals(Object)protected final java.lang.Object clone()
clone in class java.lang.Objectfinal java.lang.Object[] toArray(boolean copy)
final java.lang.Object[] toArray()
final java.lang.Object[] toArray(java.lang.Object startElement)
startElement - starting element to copyfinal void toArrayAndClear(java.lang.Object[] objs)
final void trimToSize()
final java.lang.Object get(int index)
index - index of element to return.java.lang.IndexOutOfBoundsException - if index is out of range (index
< 0 || index >= size()).final void set(int index,
java.lang.Object element)
index - index of element to replace.element - element to be stored at the specified position.java.lang.IndexOutOfBoundsException - if index out of range
(index < 0 || index >= size()).final void add(java.lang.Object o)
o - element to be appended to this list.final void remove(int index)
index - the index of the element to removed.java.lang.IndexOutOfBoundsException - if index out of range (index
< 0 || index >= size()).final void removeOrdered(int index)
index - the index of the element to removed.java.lang.IndexOutOfBoundsException - if index out of range (index
< 0 || index >= size()).final java.lang.Object removeLastElement()
java.lang.IndexOutOfBoundsException - if array is emptyfinal void shift(java.lang.Object[] objs,
int idx)
final boolean remove(java.lang.Object o)
o - the element to removed.java.lang.IndexOutOfBoundsException - if index out of range (index
< 0 || index >= size()).final void clear()
final void clearMirror()
final java.lang.Class getComponentType()
public java.lang.String toString()
toString in class java.lang.Objectprivate void writeObject(java.io.ObjectOutputStream s)
throws java.io.IOException
java.io.IOExceptionprivate void readObject(java.io.ObjectInputStream s)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionCopyright 1996-2008 Sun Microsystems, Inc. All Rights Reserved. Use is subject to license terms.