|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.h2.util.ObjectArray<T>
T - the element typepublic class ObjectArray<T>
The object array is basically the same as ArrayList. It is a bit faster than ArrayList in some versions of Java.
| Method Summary | ||
|---|---|---|
void |
add(int index,
T value)
Insert an element at the given position. |
|
void |
add(T value)
Append an object at the end of the list. |
|
void |
addAll(ObjectArray<? extends T> list)
Add all objects from the given list. |
|
void |
clear()
Remove all elements from the list. |
|
T |
get(int index)
Get the object at the given index. |
|
int |
indexOf(java.lang.Object o)
Get the index of the given object, or -1 if not found. |
|
java.util.Iterator<T> |
iterator()
|
|
static
|
newInstance()
Create a new object with the default initial capacity. |
|
static
|
newInstance(java.util.Collection<T> collection)
Create a new object with all elements of the given collection. |
|
static
|
newInstance(int capacity)
Create a new object with the given initial capacity. |
|
static
|
newInstance(T... list)
Create a new object with the given values. |
|
java.lang.Object |
remove(int index)
Remove the object at the given index. |
|
void |
removeRange(int from,
int to)
Remove a number of elements from the given start and end index. |
|
void |
set(int index,
T value)
Update the object at the given index. |
|
void |
setSize(int size)
Fill the list with empty elements until it reaches the given size. |
|
int |
size()
Get the size of the list. |
|
void |
sort(java.util.Comparator<T> comp)
Sort the elements using the given comparator. |
|
T[] |
toArray(T[] array)
Convert this list to an array. |
|
java.lang.String |
toString()
|
|
void |
trimToSize()
Shrink the array to the required size. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Method Detail |
|---|
public static <T> ObjectArray<T> newInstance(int capacity)
capacity - the initial capacity
public static <T> ObjectArray<T> newInstance(T... list)
list - the initial elements
public static <T> ObjectArray<T> newInstance()
public static <T> ObjectArray<T> newInstance(java.util.Collection<T> collection)
collection - the collection with all elements
public void add(T value)
value - the valuepublic T get(int index)
index - the index
public java.lang.Object remove(int index)
index - the index
public void removeRange(int from,
int to)
from - the start indexto - the end indexpublic void setSize(int size)
size - the new sizepublic void trimToSize()
public void add(int index,
T value)
index - the index where to insert the objectvalue - the object to insert
public void set(int index,
T value)
index - the indexvalue - the new valuepublic int size()
public T[] toArray(T[] array)
array - the target array
public void clear()
public int indexOf(java.lang.Object o)
o - the object to search
public void addAll(ObjectArray<? extends T> list)
list - the listpublic void sort(java.util.Comparator<T> comp)
comp - the comparatorpublic java.util.Iterator<T> iterator()
iterator in interface java.lang.Iterable<T>public java.lang.String toString()
toString in class java.lang.Object
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||