java.lang.Object
org.hsqldb.lib.HsqlArrayList<E>
- All Implemented Interfaces:
Collection<E>
,List<E>
- Direct Known Subclasses:
ArrayListIdentity
Intended as an asynchronous alternative to Vector.
- Since:
- 1.7.0
- Author:
- dnordahl@users
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new instance of HsqlArrayListHsqlArrayList
(int initialCapacity) Creates a new instance with the given initial capacityHsqlArrayList
(int initialCapacity, boolean minimize) Creates a new instance of HsqlArrayList that minimizes the size when emptyHsqlArrayList
(E[] data, int count) -
Method Summary
Modifier and TypeMethodDescriptionvoid
Inserts an element at the given indexboolean
Appends an element to the end of the listboolean
boolean
addAll
(Collection<? extends E> other) void
clear()
boolean
get
(int index) Gets the element at given positionE[]
getArray()
int
returns the index of given object or -1 if not foundboolean
isEmpty()
iterator()
int
remove
(int index) Removes and returns the element at given positionboolean
Replaces the element at given positionvoid
setSize
(int newSize) Increase or reduce the size, setting discarded or added elements to null.final int
size()
Returns the number of elements in the array listvoid
sort
(Comparator<? super E> c) Object[]
toArray()
<T> T[]
toArray
(T[] array) Copies all elements of the list to a[].void
toArraySlice
(E[] array, int start, int limit) Copies elements of the list from start to limit to array.toString()
void
trim()
Trims the array to be the same size as the number of elements.Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.hsqldb.lib.Collection
addAll, contains, remove
-
Constructor Details
-
HsqlArrayList
-
HsqlArrayList
public HsqlArrayList()Creates a new instance of HsqlArrayList -
HsqlArrayList
public HsqlArrayList(int initialCapacity, boolean minimize) Creates a new instance of HsqlArrayList that minimizes the size when empty- Parameters:
initialCapacity
- intminimize
- boolean
-
HsqlArrayList
public HsqlArrayList(int initialCapacity) Creates a new instance with the given initial capacity- Parameters:
initialCapacity
- int
-
-
Method Details
-
add
Inserts an element at the given index -
add
Appends an element to the end of the list -
get
Gets the element at given position -
indexOf
returns the index of given object or -1 if not found- Parameters:
o
- Object- Returns:
- int
-
remove
Removes and returns the element at given position -
set
Replaces the element at given position -
size
public final int size()Returns the number of elements in the array list -
trim
public void trim()Trims the array to be the same size as the number of elements. -
clear
public void clear()- Specified by:
clear
in interfaceCollection<E>
-
setSize
public void setSize(int newSize) Increase or reduce the size, setting discarded or added elements to null.- Parameters:
newSize
- int
-
toArray
-
toArray
public <T> T[] toArray(T[] array) Copies all elements of the list to a[].If a[] is too small, a new array or the same type is returned.
If a[] is larger, only the list elements are copied and no other change is made to the array.
Differs from the implementation in java.util.ArrayList in the second aspect.
- Type Parameters:
T
- type of array element- Parameters:
array
- T[]- Returns:
- T[]
-
toArraySlice
Copies elements of the list from start to limit to array. The array must be large enough.- Parameters:
array
- E[]start
- intlimit
- int
-
getArray
-
sort
-
lastIndexOf
-
contains
-
remove
-
addAll
-
addAll
-
isEmpty
public boolean isEmpty() -
toString
-
iterator
-