public class IntegerList extends AbstractList<Integer> implements RandomAccess, Serializable, Cloneable
This class is not thread-safe. Synchronizations (if wanted) are user's responsibility.
Vector,
Serialized FormDefined in the sis-utility module
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 |
addInt(int value)
Adds the given element as the
int primitive type. |
void |
clear()
Discards 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 |
getInt(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 |
setInt(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, subListaddAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringaddAll, contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArrayparallelStream, removeIf, streampublic 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.trimToSize()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.true.NullPointerException - if the given value is null.IllegalArgumentException - if the given value is out of bounds.public void addInt(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 getInt(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 setInt(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()
size(),
resize(int)public IntegerList clone()
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.