org.hsqldb.lib
Class HsqlLinkedList

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

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

Intended as an asynchronous alternative to HsqlArrayList. Use HsqlArrayList if the list won't be initialized sequentially and if frequent references to specific element positions will be made.

Version:
1.7.2
Author:
jcpeck@users

Field Summary
protected  int elementCount
           
 
Constructor Summary
HsqlLinkedList()
          Creates a new instance of HsqlLinkedList.
 
Method Summary
 void add(int index, Object element)
          Inserts element at index.
 boolean add(Object element)
          Appends element to the end of this list.
 Object get(int index)
          Gets the element at given position
protected  org.hsqldb.lib.HsqlLinkedList.Node getInternal(int index)
          Helper method that returns the Node at index.
 boolean isEmpty()
           
 Iterator iterator()
           
 Object remove(int index)
          Removes and returns the element at index.
 Object set(int index, Object element)
          Replaces the current element at index/code> with element.
 int size()
          Accessor for the size of this linked list.
 String toString()
          Returns a string representation
 
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

HsqlLinkedList

public HsqlLinkedList()
Creates a new instance of HsqlLinkedList.

Method Detail

add

public void add(int index,
                Object element)
Inserts element at index.

Specified by:
add in interface HsqlList
Throws:
IndexOutOfBoundsException - if index < 0 or is > size.

add

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

Specified by:
add in interface HsqlList
Returns:
true

get

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

Specified by:
get in interface HsqlList
Throws:
IndexOutOfBoundsException - if index is not valid index within the list (0 <= index < size).

remove

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

Specified by:
remove in interface HsqlList
Throws:
IndexOutOfBoundsException - if index is not valid index within the list (0 <= index < size).

set

public Object set(int index,
                  Object element)
Replaces the current element at index/code> with element.

Specified by:
set in interface HsqlList
Returns:
The current element at index.

size

public final int size()
Accessor for the size of this linked list. The size is the total number of elements in the list and is one greater than the largest index in the list.

Specified by:
size in interface HsqlList
Returns:
The size of this.

getInternal

protected final org.hsqldb.lib.HsqlLinkedList.Node getInternal(int index)
Helper method that returns the Node at index.

Parameters:
index - The index of the Node to return.
Returns:
The Node at the given index.
Throws:
IndexOutOfBoundsException - if index is not valid index within the list (0 <= index < size).

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.