Class HsqlArrayList<E>
java.lang.Object
org.hsqldb.lib.HsqlArrayList<E>
- All Implemented Interfaces:
Collection<E>, List<E>
- Direct Known Subclasses:
ArrayListIdentity
-
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, boolean minimize) -
Method Summary
Modifier and TypeMethodDescriptionvoidInserts an element at the given indexbooleanAppends an element to the end of the listbooleanbooleanaddAll(Collection<? extends E> other) voidclear()booleanget(int index) Gets the element at given positionE[]getArray()intreturns the index of given object or -1 if not foundbooleanisEmpty()iterator()intlastIndexOf(E o) remove(int index) Removes and returns the element at given positionbooleanReplaces the element at given positionvoidsetSize(int newSize) Increase or reduce the size, setting discarded or added elements to null.final intsize()Returns the number of elements in the array listvoidsort(Comparator<? super E> c) Object[]toArray()<T> T[]toArray(T[] array) Copies all elements of the list to a[].voidtoArraySlice(E[] array, int start, int limit) Copies elements of the list from start to limit to array.toString()voidtrim()Trims the array to be the same size as the number of elements.Methods inherited from interface Collection
addAll
-
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
-
add
-
get
-
indexOf
returns the index of given object or -1 if not found- Parameters:
o- Object- Returns:
- int
-
contains
- Specified by:
containsin interfaceCollection<E>
-
remove
- Specified by:
removein interfaceCollection<E>
-
remove
-
set
-
size
-
trim
public void trim()Trims the array to be the same size as the number of elements. -
clear
public void clear()- Specified by:
clearin 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
-
addAll
-
addAll
-
isEmpty
public boolean isEmpty() -
toString
-
iterator
-