java.io.Serializable
, java.lang.Cloneable
public class LongList
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable
Using this list for storing ints is much faster than creating java.lang.Integer objects and storing them in an ArrayList.
This list is not synchronized and does not implement the full List interface. In fact, this list can only be used to add new values or to clear the complete list.
Constructor | Description |
---|---|
LongList(int capacity) |
Creates a new IntList with the given initial capacity.
|
Modifier and Type | Method | Description |
---|---|---|
void |
add(long value) |
Adds the given int value to the list.
|
void |
clear() |
Clears the list.
|
java.lang.Object |
clone() |
|
long |
get(int index) |
Returns the value at the given index.
|
void |
set(int index,
long value) |
Adds the given int value to the list.
|
int |
size() |
Returns the number of elements in this list.
|
long[] |
toArray() |
Copys the list contents into a new array.
|
public LongList(int capacity)
capacity
- the initial capacity.public void add(long value)
value
- the new value to be added.public void set(int index, long value)
value
- the new value to be added.public long get(int index)
index
- the indexjava.lang.IndexOutOfBoundsException
- if the index is greater or
equal to the list size or if the index is negative.public void clear()
public int size()
public long[] toArray()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException