org.hsqldb.lib
Class HsqlArrayList

java.lang.Object
  extended byorg.hsqldb.lib.BaseList
      extended byorg.hsqldb.lib.HsqlArrayList
All Implemented Interfaces:
HsqlList

public class HsqlArrayList
extends org.hsqldb.lib.BaseList
implements HsqlList

Intended as an asynchronous alternative to Vector. Use HsqlLinkedList instead if its better suited.

Version:
1.7.2
Author:
dnordahl@users

Field Summary
protected  int elementCount
           
 
Constructor Summary
HsqlArrayList()
          Creates a new instance of HsqlArrayList
HsqlArrayList(int initialCapacity)
          Creates a new instance with the given initial capacity
 
Method Summary
 void add(int index, Object element)
          Inserts an element at the given index
 boolean add(Object element)
          Appends an element to the end of the list
 void clear()
           
 Object get(int index)
          Gets the element at given position
 boolean isEmpty()
           
 Iterator iterator()
           
 Object remove(int index)
          Removes and returns the element at given position
 void remove(Object obj)
           
 Object set(int index, Object element)
          Replaces the element at given position
 void setSize(int newSize)
           
 int size()
          Returns the number of elements in the array list
 void sort(ObjectComparator c)
           
 Object[] toArray()
           
 Object toArray(Object a)
          Copies all elements of the list to a[].
 String toString()
          Returns a string representation
 void trim()
          Trims the array to be the same size as the number of elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.hsqldb.lib.HsqlList
isEmpty, iterator
 

Field Detail

elementCount

protected int elementCount
Constructor Detail

HsqlArrayList

public HsqlArrayList()
Creates a new instance of HsqlArrayList


HsqlArrayList

public HsqlArrayList(int initialCapacity)
Creates a new instance with the given initial capacity

Method Detail

add

public void add(int index,
                Object element)
Inserts an element at the given index

Specified by:
add in interface HsqlList

add

public boolean add(Object element)
Appends an element to the end of the list

Specified by:
add in interface HsqlList

get

public Object get(int index)
Gets the element at given position

Specified by:
get in interface HsqlList

remove

public Object remove(int index)
Removes and returns the element at given position

Specified by:
remove in interface HsqlList

set

public Object set(int index,
                  Object element)
Replaces the element at given position

Specified by:
set in interface HsqlList

size

public final int size()
Returns the number of elements in the array list

Specified by:
size in interface HsqlList

trim

public void trim()
Trims the array to be the same size as the number of elements.


clear

public void clear()

setSize

public void setSize(int newSize)

toArray

public Object[] toArray()

toArray

public Object toArray(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(ObjectComparator c)

remove

public void remove(Object obj)

isEmpty

public boolean isEmpty()

toString

public String toString()
Returns a string representation


iterator

public Iterator iterator()


Copyright © 2001 - 2004 HSQL Development Group. All Rights Reserved.