public class IntList extends AbstractList<Integer> implements Serializable
ArrayList
to store integers.
Null is not allowed into the list.modCount
Constructor and Description |
---|
IntList()
Creates a new IntList
|
IntList(Collection<Integer> c) |
IntList(int capacity)
Creates a new IntList with the given initial capacity
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(int e)
Operates exactly as
add(java.lang.Integer) |
boolean |
add(Integer e) |
void |
add(int index,
int element)
Operates exactly as
add(int, java.lang.Integer) |
void |
add(int index,
Integer element) |
boolean |
addAll(Collection<? extends Integer> c) |
void |
clear() |
Integer |
get(int index) |
int |
getI(int index)
Operates exactly as
get(int) |
Integer |
remove(int index) |
int |
set(int index,
int element)
Operates exactly as
set(int, java.lang.Integer) |
Integer |
set(int index,
Integer element) |
int |
size() |
void |
sort()
Efficiently sorts this list of integers using
Arrays.sort(int[]) . |
static List<Integer> |
unmodifiableView(int[] array,
int length)
Creates and returns an unmodifiable view of the given int array that
requires only a small object allocation.
|
static IntList |
view(int[] array,
int length)
Creates and returns a view of the given int array that requires only
a small object allocation.
|
addAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
contains, containsAll, isEmpty, remove, removeAll, replaceAll, retainAll, sort, spliterator, toArray, toArray
parallelStream, removeIf, stream
public IntList()
public IntList(int capacity)
capacity
- the starting internal storage space sizepublic IntList(Collection<Integer> c)
public void clear()
clear
in interface Collection<Integer>
clear
in interface List<Integer>
clear
in class AbstractList<Integer>
public int set(int index, int element)
set(int, java.lang.Integer)
index
- the index to setelement
- the value to setpublic void add(int index, int element)
add(int, java.lang.Integer)
index
- the index to add the value intoelement
- the value to addpublic void add(int index, Integer element)
public boolean add(int e)
add(java.lang.Integer)
e
- the value to addpublic boolean add(Integer e)
add
in interface Collection<Integer>
add
in interface List<Integer>
add
in class AbstractList<Integer>
public int getI(int index)
get(int)
index
- the index of the value to getpublic Integer get(int index)
public int size()
size
in interface Collection<Integer>
size
in interface List<Integer>
size
in class AbstractCollection<Integer>
public boolean addAll(Collection<? extends Integer> c)
addAll
in interface Collection<Integer>
addAll
in interface List<Integer>
addAll
in class AbstractCollection<Integer>
public Integer remove(int index)
public void sort()
Arrays.sort(int[])
.public static List<Integer> unmodifiableView(int[] array, int length)
array
- the array to wrap into an unmodifiable listlength
- the number of values of the array to use, starting from zeropublic static IntList view(int[] array, int length)
array
- the array to wrap by an IntList objectlength
- the initial length of the listCopyright © 2017. All rights reserved.