Package org.jfree.layouting.util
Class IntList
- java.lang.Object
-
- org.jfree.layouting.util.IntList
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
public class IntList extends java.lang.Object implements java.io.Serializable, java.lang.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.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.- Author:
- Thomas Morgner
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description IntList(int capacity)
Creates a new IntList with the given initial capacity.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int value)
Adds the given int value to the list.void
clear()
Clears the list.java.lang.Object
clone()
int
get(int index)
Returns the value at the given index.int
peek()
int
pop()
void
push(int value)
void
set(int index, int value)
Adds the given int value to the list.int
size()
Returns the number of elements in this list.int[]
toArray()
Copys the list contents into a new array.
-
-
-
Method Detail
-
add
public void add(int value)
Adds the given int value to the list.- Parameters:
value
- the new value to be added.
-
set
public void set(int index, int value)
Adds the given int value to the list.- Parameters:
value
- the new value to be added.
-
get
public int get(int index)
Returns the value at the given index.- Parameters:
index
- the index- Returns:
- the value at the given index
- Throws:
java.lang.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
-
pop
public int pop()
-
peek
public int peek()
-
push
public final void push(int value)
-
toArray
public int[] toArray()
Copys the list contents into a new array.- Returns:
- the list contents as array.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
- Overrides:
clone
in classjava.lang.Object
- Throws:
java.lang.CloneNotSupportedException
-
-