Class LongList
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.util.LongList
-
- All Implemented Interfaces:
Serializable
,Cloneable
- Direct Known Subclasses:
LongSequence
public class LongList extends Object implements Serializable, Cloneable
A Array-List for integer objects. Ints can be added to the list and will be stored in an int-array. Using this list for storing ints is much faster than creating java.lang.Long 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.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(long value)
Adds the given int value to the list.void
clear()
Clears the list.Object
clone()
Creates a copy of this list.void
fill(long value)
long
get(int index)
Returns the value at the given index.void
remove(int 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.long[]
toArray(long[] retval)
Copys the list contents into a new array.String
toString()
-
-
-
Constructor Detail
-
LongList
public LongList(int capacity)
Creates a new IntList with the given initial capacity. The capacity will also be used as increment value when extending the capacity of the list.- Parameters:
capacity
- the initial capacity.
-
LongList
public LongList(long[] data, int increment)
-
-
Method Detail
-
add
public void add(long value)
Adds the given int value to the list.- Parameters:
value
- the new value to be added.
-
remove
public void remove(int index)
-
set
public void set(int index, long value)
Adds the given int value to the list.- Parameters:
value
- the new value to be defined.index
- the position of the valur that should be redefined.
-
get
public long get(int index)
Returns the value at the given index.- Parameters:
index
- the index- Returns:
- the value at the given index
- Throws:
IndexOutOfBoundsException
- if the index is greater or equal to the list size or if the index is negative.
-
clear
public void clear()
Clears the list.
-
size
public int size()
Returns the number of elements in this list.- Returns:
- the number of elements in the list
-
toArray
public long[] toArray()
Copys the list contents into a new array.- Returns:
- the list contents as array.
-
toArray
public long[] toArray(long[] retval)
Copys the list contents into a new array.- Parameters:
retval
- the array that should receive the contents.- Returns:
- the list contents as array.
-
clone
public Object clone() throws CloneNotSupportedException
Creates a copy of this list.- Overrides:
clone
in classObject
- Returns:
- a copy of this list.
- Throws:
CloneNotSupportedException
- if something went wrong during the cloning.
-
fill
public void fill(long value)
-
-