-bottom

com.jivesoftware.util
Class LongList

java.lang.Object
  |
  +--com.jivesoftware.util.LongList

public class LongList
extends Object

A simplified List for long values. Only the bare number of methods needed by Jive have been implemented so far, so additional implementation work would be welcome.

The implementation uses an array for maximum speed. If the number of elements grows larger than capacity, the capacity will automatically grow.


Constructor Summary
LongList()
          Creates a new list of long values with a default capacity of 50.
LongList(int initialCapacity)
          Creates a new list of long values with a specified initial capacity.
 
Method Summary
 void add(long value)
          Adds a new long value to the end of the list.
 long get(int index)
          Returns the long value at the specified index.
 int size()
          Returns the number of elements in the list.
 long[] toArray()
          Returns a new array containing the list elements.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongList

public LongList()
Creates a new list of long values with a default capacity of 50.

LongList

public LongList(int initialCapacity)
Creates a new list of long values with a specified initial capacity.
Parameters:
initialCapacity - a capacity to initialize the list with.
Method Detail

add

public void add(long value)
Adds a new long value to the end of the list.

get

public long get(int index)
Returns the long value at the specified index. If the index is not valid, an IndexOutOfBoundException will be thrown.
Parameters:
index - the index of the value to return.
Returns:
the value at the specified index.

size

public int size()
Returns the number of elements in the list.
Returns:
the number of elements in the list.

toArray

public long[] toArray()
Returns a new array containing the list elements.
Returns:
an array of the list elements.

toString

public String toString()
Overrides:
toString in class Object

-bottom