org.hsqldb.lib
Class HsqlArrayList
- java.lang.Object
-
- org.hsqldb.lib.HsqlArrayList
-
- All Implemented Interfaces:
- Collection, HsqlList
- Direct Known Subclasses:
- ArrayListIdentity
public class HsqlArrayList extends java.lang.Object implements HsqlList
Intended as an asynchronous alternative to Vector. Use HsqlLinkedList instead if it's better suited.- Since:
- 1.7.0
-
-
Constructor Summary
Constructors Constructor and Description HsqlArrayList()Creates 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(java.lang.Object[] data, int count)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(int index, java.lang.Object element)Inserts an element at the given indexbooleanadd(java.lang.Object element)Appends an element to the end of the listbooleanaddAll(Collection other)booleanaddAll(java.lang.Object[] array)voidclear()booleancontains(java.lang.Object o)java.lang.Objectget(int index)Gets the element at given positionjava.lang.Object[]getArray()intindexOf(java.lang.Object o)returns the index of given object or -1 if not foundbooleanisEmpty()Iteratoriterator()java.lang.Objectremove(int index)Removes and returns the element at given positionbooleanremove(java.lang.Object o)java.lang.Objectset(int index, java.lang.Object element)Replaces the element at given positionvoidsetSize(int newSize)Increase or reduce the size, setting discarded or added elements to null.intsize()Returns the number of elements in the array listvoidsort(java.util.Comparator c)java.lang.Object[]toArray()java.lang.Object[]toArray(int start, int limit)java.lang.ObjecttoArray(java.lang.Object a)Copies all elements of the list to a[].java.lang.StringtoString()Returns a string representationvoidtrim()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, hashCode, remove
-
-
-
-
Constructor Detail
-
HsqlArrayList
public HsqlArrayList(java.lang.Object[] data, int count)
-
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
-
HsqlArrayList
public HsqlArrayList(int initialCapacity)
Creates a new instance with the given initial capacity
-
-
Method Detail
-
add
public void add(int index, java.lang.Object element)Inserts an element at the given index
-
add
public boolean add(java.lang.Object element)
Appends an element to the end of the list- Specified by:
addin interfaceCollection- Specified by:
addin interfaceHsqlList
-
get
public java.lang.Object get(int index)
Gets the element at given position
-
indexOf
public int indexOf(java.lang.Object o)
returns the index of given object or -1 if not found
-
remove
public java.lang.Object remove(int index)
Removes and returns the element at given position
-
set
public java.lang.Object set(int index, java.lang.Object element)Replaces the element at given position
-
size
public final int size()
Returns the number of elements in the array list- Specified by:
sizein interfaceCollection- Specified by:
sizein interfaceHsqlList
-
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
-
setSize
public void setSize(int newSize)
Increase or reduce the size, setting discarded or added elements to null.
-
toArray
public java.lang.Object[] toArray()
-
toArray
public java.lang.Object[] toArray(int start, int limit)
-
toArray
public java.lang.Object toArray(java.lang.Object a)
Copies all elements of the list to a[]. It is assumed a[] is of the correct type. 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.
-
sort
public void sort(java.util.Comparator c)
-
getArray
public java.lang.Object[] getArray()
-
contains
public boolean contains(java.lang.Object o)
-
remove
public boolean remove(java.lang.Object o)
-
addAll
public boolean addAll(Collection other)
-
addAll
public boolean addAll(java.lang.Object[] array)
-
isEmpty
public boolean isEmpty()
-
toString
public java.lang.String toString()
Returns a string representation- Overrides:
toStringin classjava.lang.Object
-
iterator
public Iterator iterator()
-
-
DataMelt 3.0 © DataMelt by jWork.ORG