Class BulkArrayList<T>
- java.lang.Object
-
- org.pentaho.reporting.engine.classic.core.util.BulkArrayList<T>
-
- All Implemented Interfaces:
Cloneable
public class BulkArrayList<T> extends Object implements Cloneable
An Array-List with a linear instead of exponential growth. 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
BulkArrayList.Func<T>
-
Constructor Summary
Constructors Constructor Description BulkArrayList(int capacity)
Creates a new IntList with the given initial capacity.BulkArrayList(T[] data, int increment)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(T value)
Adds the given int value to the list.void
clear()
Clears the list.BulkArrayList<T>
clone()
Creates a copy of this list.void
foreach(BulkArrayList.Func<T> func)
void
foreach(BulkArrayList.Func<T> func, int start, int end)
T
get(int index)
Returns the value at the given index.void
remove(int index)
void
removeRange(int index, int count)
void
set(int index, T value)
Adds the given int value to the list.int
size()
Returns the number of elements in this list.<T> T[]
toArray(T[] retval)
Copys the list contents into a new array.
-
-
-
Constructor Detail
-
BulkArrayList
public BulkArrayList(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.
-
BulkArrayList
public BulkArrayList(T[] data, int increment)
-
-
Method Detail
-
add
public void add(T 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, T 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.
-
removeRange
public void removeRange(int index, int count)
-
get
public T 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 <T> T[] toArray(T[] 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 BulkArrayList<T> 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.
-
foreach
public void foreach(BulkArrayList.Func<T> func)
-
foreach
public void foreach(BulkArrayList.Func<T> func, int start, int end)
-
-