Top Description Fields Constructors Methods
org.hsqldb.lib

public Class HsqlArrayList<E>

extends BaseList<E>
implements List<E>
Class Inheritance
All Implemented Interfaces
org.hsqldb.lib.List, org.hsqldb.lib.Collection
Known Direct Subclasses
org.hsqldb.lib.ArrayListIdentity
Imports
java.lang.reflect.Array, java.util.Arrays, .Comparator

Intended as an asynchronous alternative to Vector.
Author
dnordahl@users
Since
1.7.0
Version
2.7.3

Field Summary

Modifier and TypeField and Description
private static final int
private static final float
pack-priv Object[]
private final boolean
pack-priv Object[]
private final boolean
Inherited from org.hsqldb.lib.BaseList:
comparatorelementCount

Constructor Summary

AccessConstructor and Description
public
HsqlArrayList(E[] data, int count, boolean minimize)

public
HsqlArrayList()

Creates a new instance of HsqlArrayList

public
HsqlArrayList(int
int
initialCapacity
,
boolean
boolean
minimize
)

Creates a new instance of HsqlArrayList that minimizes the size when empty

public
HsqlArrayList(int
int
initialCapacity
)

Creates a new instance with the given initial capacity

Method Summary

Modifier and TypeMethod and Description
public void
add(int
int
index
,
E
E
element
)

Implements org.hsqldb.lib.List.add.

Inserts an element at the given index

public boolean

Returns:

boolean
add
(E
E
element
)

Implements abstract org.hsqldb.lib.BaseList.add.

Implements org.hsqldb.lib.List.add.

Appends an element to the end of the list

public void
public boolean
public E

Returns:

E
get
(int
int
index
)

Implements abstract org.hsqldb.lib.BaseList.get.

Implements org.hsqldb.lib.List.get.

Gets the element at given position

public E[]
private void
public int

Returns:

int
indexOf
(E
Object
o
)

Overrides org.hsqldb.lib.BaseList.indexOf.

returns the index of given object or -1 if not found

public int
public boolean
public E

Returns:

E
remove
(int
int
index
)

Implements abstract org.hsqldb.lib.BaseList.remove.

Implements org.hsqldb.lib.List.remove.

Removes and returns the element at given position

private void
resize(int baseSize)

public E

Returns:

E
set
(int
int
index
,
E
E
element
)

Implements org.hsqldb.lib.List.set.

Replaces the element at given position

public void
setSize(int
int
newSize
)

Increase or reduce the size, setting discarded or added elements to null.

public final int

Returns:

int
size
()

Implements abstract org.hsqldb.lib.BaseList.size.

Implements org.hsqldb.lib.List.size.

Returns the number of elements in the array list

public void
sort(Comparator<? super E> c)

public Object[]
public <
type of array element
T
>
T[]

Returns:

T[]
toArray
(T[]
T[]
array
)

Copies all elements of the list to a[].

public void
toArraySlice(E[]
E[]
array
,
int
int
start
,
int
int
limit
)

Copies elements of the list from start to limit to array.

public void
trim()

Trims the array to be the same size as the number of elements.

Inherited from org.hsqldb.lib.BaseList:
addAlladdAllisEmptyiteratortoString

Field Detail

DEFAULT_INITIAL_CAPACITYback to summary
private static final int DEFAULT_INITIAL_CAPACITY
DEFAULT_RESIZE_FACTORback to summary
private static final float DEFAULT_RESIZE_FACTOR
elementDataback to summary
pack-priv Object[] elementData
minimizeOnClearback to summary
private final boolean minimizeOnClear
reserveElementDataback to summary
pack-priv Object[] reserveElementData
typedArrayback to summary
private final boolean typedArray

Constructor Detail

HsqlArrayListback to summary
public HsqlArrayList(E[] data, int count, boolean minimize)
HsqlArrayListback to summary
public HsqlArrayList()

Creates a new instance of HsqlArrayList

Annotations
@SuppressWarnings:unchecked
HsqlArrayListback to summary
public HsqlArrayList(int initialCapacity, boolean minimize)

Creates a new instance of HsqlArrayList that minimizes the size when empty

Parameters
initialCapacity:int

int

minimize:boolean

boolean

Annotations
@SuppressWarnings:unchecked
HsqlArrayListback to summary
public HsqlArrayList(int initialCapacity)

Creates a new instance with the given initial capacity

Parameters
initialCapacity:int

int

Annotations
@SuppressWarnings:unchecked

Method Detail

addback to summary
public void add(int index, E element)

Implements org.hsqldb.lib.List.add.

Inserts an element at the given index

Parameters
index:int

int

element:E

E

addback to summary
public boolean add(E element)

Implements abstract org.hsqldb.lib.BaseList.add.

Implements org.hsqldb.lib.List.add.

Appends an element to the end of the list

Parameters
element:E

E

Returns:boolean

boolean

Annotations
@Override
clearback to summary
public void clear()

Implements org.hsqldb.lib.Collection.clear.

containsback to summary
public boolean contains(Object o)

Overrides org.hsqldb.lib.BaseList.contains.

Implements org.hsqldb.lib.Collection.contains.

Annotations
@Override
getback to summary
public E get(int index)

Implements abstract org.hsqldb.lib.BaseList.get.

Implements org.hsqldb.lib.List.get.

Gets the element at given position

Parameters
index:int

int

Returns:E

E

Annotations
@Override
getArrayback to summary
public E[] getArray()
increaseCapacityback to summary
private void increaseCapacity()
indexOfback to summary
public int indexOf(E o)

Overrides org.hsqldb.lib.BaseList.indexOf.

returns the index of given object or -1 if not found

Parameters
o:E

Object

Returns:int

int

Annotations
@Override
lastIndexOfback to summary
public int lastIndexOf(E o)
removeback to summary
public boolean remove(E o)

Implements org.hsqldb.lib.Collection.remove.

Annotations
@Override
removeback to summary
public E remove(int index)

Implements abstract org.hsqldb.lib.BaseList.remove.

Implements org.hsqldb.lib.List.remove.

Removes and returns the element at given position

Parameters
index:int

int

Returns:E

E

Annotations
@Override
resizeback to summary
private void resize(int baseSize)
setback to summary
public E set(int index, E element)

Implements org.hsqldb.lib.List.set.

Replaces the element at given position

Parameters
index:int

int

element:E

E

Returns:E

E

setSizeback to summary
public void setSize(int newSize)

Increase or reduce the size, setting discarded or added elements to null.

Parameters
newSize:int

int

sizeback to summary
public final int size()

Implements abstract org.hsqldb.lib.BaseList.size.

Implements org.hsqldb.lib.List.size.

Returns the number of elements in the array list

Returns:int

int

Annotations
@Override
sortback to summary
public void sort(Comparator<? super E> c)
toArrayback to summary
public Object[] toArray()
toArrayback to summary
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.

Parameters
<T>
type of array element
array:T[]

T[]

Returns:T[]

T[]

toArraySliceback to summary
public void toArraySlice(E[] array, int start, int limit)

Copies elements of the list from start to limit to array. The array must be large enough.

Parameters
array:E[]

E[]

start:int

int

limit:int

int

trimback to summary
public void trim()

Trims the array to be the same size as the number of elements.