|
||||||||||
| 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 responsibility.
| utility/geotk-utility (download) | View source code for this class |
| 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 |
occurrence(int value)
Returns the occurrence of the given value in this list. |
Integer |
remove(int index)
Removes the element at the given index. |
int |
removeLast()
Retrieves and remove the last element of this list. |
protected void |
removeRange(int lower,
int upper)
Removes all values in the given range of index. |
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, 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.removeLast()
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 Integer remove(int index)
throws IndexOutOfBoundsException
remove in interface List<Integer>remove in class AbstractList<Integer>index - The index of the element to remove.
IndexOutOfBoundsException - if the given index is out of bounds.
public int removeLast()
throws NoSuchElementException
NoSuchElementException - if this list is empty.
protected void removeRange(int lower,
int upper)
removeRange in class AbstractList<Integer>lower - Index of the first element to remove, inclusive.upper - Index after the last element to be removed.public int occurrence(int value)
value - The value to search for.
public void trimToSize()
public IntegerList clone()
clone in class ObjectObject.clone()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||