|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
ObjectAbstractCollection<E>
AbstractList<Integer>
IntegerList
public class IntegerList
A list of unsigned integer values. This class packs the values in the minimal amount of bits required for storing unsigned integers of the given maximal value.
This class is not thread-safe. Synchronizations (if wanted) are user's reponsability.
Field Summary |
---|
Fields inherited from class AbstractList |
---|
modCount |
Constructor Summary | |
---|---|
IntegerList(int initialCapacity,
int maximalValue)
Creates an initially empty list with the given initial capacity. |
|
IntegerList(int initialCapacity,
int maximalValue,
boolean fill)
Creates a new list with the given initial size. |
Method Summary | |
---|---|
boolean |
add(Integer value)
Adds the given element to this list. |
void |
addInteger(int value)
Adds the given element as the int primitive type. |
void |
clear()
Discarts all elements in this list. |
IntegerList |
clone()
Returns a clone of this list. |
void |
fill(int value)
Fills the list with the given value. |
Integer |
get(int index)
Returns the element at the given index. |
int |
getInteger(int index)
Returns the element at the given index as the int primitive type. |
int |
maximalValue()
Returns the maximal value that can be stored in this list. |
int |
occurence(int value)
Returns the occurence of the given value in this list. |
void |
resize(int size)
Sets the list size to the given value. |
Integer |
set(int index,
Integer value)
Sets the element at the given index. |
void |
setInteger(int index,
int value)
Sets the element at the given index as the int primitive type. |
int |
size()
Returns the current number of values in this list. |
void |
trimToSize()
Trims the capacity of this list to be its current size. |
Methods inherited from class AbstractList |
---|
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList |
Methods inherited from class AbstractCollection |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString |
Methods inherited from class Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface List |
---|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray |
Constructor Detail |
---|
public IntegerList(int initialCapacity, int maximalValue)
initialCapacity
- The initial capacity.maximalValue
- The maximal value to be allowed, inclusive.public IntegerList(int initialCapacity, int maximalValue, boolean fill)
initialCapacity
- The initial capacity.maximalValue
- The maximal value to be allowed, inclusive.fill
- If true
, the initial size is set to the initial
capacity with all values set to 0.Method Detail |
---|
public int maximalValue()
public int size()
size
in interface Collection<Integer>
size
in interface List<Integer>
size
in class AbstractCollection<Integer>
public void resize(int size)
size
- The new size.public void fill(int value)
size
exclusive.
value
- The value to set.public void clear()
clear
in interface Collection<Integer>
clear
in interface List<Integer>
clear
in class AbstractList<Integer>
public boolean add(Integer value) throws IllegalArgumentException
add
in interface Collection<Integer>
add
in interface List<Integer>
add
in class AbstractList<Integer>
value
- The value to add.
NullPointerException
- if the given value is null.
IllegalArgumentException
- if the given value is out of bounds.public void addInteger(int value) throws IllegalArgumentException
int
primitive type.
value
- The value to add.
IllegalArgumentException
- if the given value is out of bounds.public Integer get(int index) throws IndexOutOfBoundsException
get
in interface List<Integer>
get
in class AbstractList<Integer>
index
- The element index.
IndexOutOfBoundsException
- if the given index is out of bounds.public int getInteger(int index) throws IndexOutOfBoundsException
int
primitive type.
index
- The element index.
IndexOutOfBoundsException
- if the given index is out of bounds.public Integer set(int index, Integer value) throws IndexOutOfBoundsException
set
in interface List<Integer>
set
in class AbstractList<Integer>
index
- The element index.value
- The value at the given index.
IndexOutOfBoundsException
- if the given index is out of bounds.
IllegalArgumentException
- if the given value is out of bounds.
NullPointerException
- if the given value is null.public void setInteger(int index, int value) throws IndexOutOfBoundsException
int
primitive type.
index
- The element index.value
- The value at the given index.
IndexOutOfBoundsException
- if the given index is out of bounds.
IllegalArgumentException
- if the given value is out of bounds.public int occurence(int value)
value
- The value to search for.
public void trimToSize()
public IntegerList clone()
clone
in class Object
Object.clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |