Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.util
Class LongList

java.lang.Object
  extended by com.jivesoftware.util.LongList
All Implemented Interfaces:
java.io.Serializable

public final class LongList
extends java.lang.Object
implements java.io.Serializable

A List type class for long values. The implementation uses an array. If the number of elements grows larger than the capacity, the capacity will automatically grow.

See Also:
Serialized Form

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.
LongList(long[] longArray)
          Creates a new list of long values with an initial array of elements.
 
Method Summary
 void add(int index, long value)
          Adds a long value to the list at the specified index.
 void add(long value)
          Adds a long value to the end of the list.
 void add(LongList toAdd)
          Adds all elements of a LongList to this one.
 void clear()
          Removes all of the elements from the list.
 boolean contains(long value)
          Returns true if the list contains the specified value.
 boolean equals(java.lang.Object o)
           
 long get(int index)
          Returns the long value at the specified index.
 int hashCode()
           
 int indexOf(long value)
          Returns the index in this list of the first occurrence of the specified value, or -1 if this list does not contain this value.
 void remove(int index)
          Removes a value from the list at the specified index.
 int size()
          Returns the number of elements in the list.
 LongList slice(int startIndex, int length)
          Returns a slice of the list.
 long[] toArray()
          Returns a new array containing the list elements.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, 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.

LongList

public LongList(long[] longArray)
Creates a new list of long values with an initial array of elements.

Parameters:
longArray - an array to create a list from.
Method Detail

add

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

Parameters:
value - the value to add to the list.

add

public void add(int index,
                long value)
Adds a long value to the list at the specified index.

Parameters:
index - the index in the list to add the value at.
value - the value to add to the list.

remove

public void remove(int index)
Removes a value from the list at the specified index.

Parameters:
index - the index to remove a value at.

clear

public void clear()
Removes all of the elements from 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.

indexOf

public int indexOf(long value)
Returns the index in this list of the first occurrence of the specified value, or -1 if this list does not contain this value.

Parameters:
value - the value to search for.
Returns:
the index in this list of the first occurrence of the specified value, or -1 if this list does not contain this value.

contains

public boolean contains(long value)
Returns true if the list contains the specified value.

Parameters:
value - the value to search for.
Returns:
true if value is found in the list.

size

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

Returns:
the number of elements in the list.

slice

public LongList slice(int startIndex,
                      int length)
Returns a slice of the list.

Parameters:
startIndex - - where to start
length - - amount of elements to get.

add

public void add(LongList toAdd)
Adds all elements of a LongList to this one.

Parameters:
toAdd - - the elements to add.

toArray

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

Returns:
an array of the list elements.

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.