public class IntegerList extends AbstractList<Integer> implements RandomAccess, Serializable, Cloneable
This class is not thread-safe. Synchronizations (if wanted) are user's reponsability.
modCount
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
add, addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, subList
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
addAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
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.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()
Copyright © 1996–2019 Geotools. All rights reserved.