Interface IntList
-
- All Superinterfaces:
java.util.Collection<java.lang.Integer>,java.lang.Comparable<java.util.List<? extends java.lang.Integer>>,IntCollection,IntIterable,java.lang.Iterable<java.lang.Integer>,java.util.List<java.lang.Integer>
- All Known Implementing Classes:
AbstractIntList,AbstractIntList.IntSubList,IntArrayList,IntLists.EmptyList,IntLists.Singleton,IntLists.SynchronizedList,IntLists.SynchronizedRandomAccessList,IntLists.UnmodifiableList,IntLists.UnmodifiableRandomAccessList
public interface IntList extends java.util.List<java.lang.Integer>, java.lang.Comparable<java.util.List<? extends java.lang.Integer>>, IntCollection
A type-specificList; provides some additional methods that use polymorphism to avoid (un)boxing.Note that this type-specific interface extends
Comparable: it is expected that implementing classes perform a lexicographical comparison using the standard operator "less then" for primitive types, and the usualcompareTo()method for objects.Additionally, this interface strengthens
listIterator(),listIterator(int)andsubList(int,int).Besides polymorphic methods, this interfaces specifies methods to copy into an array or remove contiguous sublists. Although the abstract implementation of this interface provides simple, one-by-one implementations of these methods, it is expected that concrete implementation override them with optimized versions.
- See Also:
List
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description booleanadd(int key)Appends the specified element to the end of this list (optional operation).voidadd(int index, int key)Inserts the specified element at the specified position in this list (optional operation).default voidadd(int index, java.lang.Integer key)Deprecated.Please use the corresponding type-specific method instead.default booleanadd(java.lang.Integer k)Deprecated.Please use the corresponding type-specific method instead.booleanaddAll(int index, IntCollection c)Inserts all of the elements in the specified type-specific collection into this type-specific list at the specified position (optional operation).booleanaddAll(int index, IntList c)Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).booleanaddAll(IntList c)Appends all of the elements in the specified type-specific list to the end of this type-specific list (optional operation).voidaddElements(int index, int[] a)Add (hopefully quickly) elements to this type-specific list.voidaddElements(int index, int[] a, int offset, int length)Add (hopefully quickly) elements to this type-specific list.default booleancontains(java.lang.Object key)Deprecated.Please use the corresponding type-specific method instead.default java.lang.Integerget(int index)Deprecated.Please use the corresponding type-specific method instead.voidgetElements(int from, int[] a, int offset, int length)Copies (hopefully quickly) elements of this type-specific list into the given array.intgetInt(int index)Returns the element at the specified position in this list.intindexOf(int k)Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.default intindexOf(java.lang.Object o)Deprecated.Please use the corresponding type-specific method instead.IntListIteratoriterator()Returns a type-specific iterator on the elements of this list.intlastIndexOf(int k)Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.default intlastIndexOf(java.lang.Object o)Deprecated.Please use the corresponding type-specific method instead.IntListIteratorlistIterator()Returns a type-specific list iterator on the list.IntListIteratorlistIterator(int index)Returns a type-specific list iterator on the list starting at a given index.default java.lang.Integerremove(int index)Deprecated.Please use the corresponding type-specific method instead.default booleanremove(java.lang.Object key)Deprecated.Please use the corresponding type-specific method instead.voidremoveElements(int from, int to)Removes (hopefully quickly) elements of this type-specific list.intremoveInt(int index)Removes the element at the specified position in this list (optional operation).intset(int index, int k)Replaces the element at the specified position in this list with the specified element (optional operation).default java.lang.Integerset(int index, java.lang.Integer k)Deprecated.Please use the corresponding type-specific method instead.voidsize(int size)Sets the size of this list.IntListsubList(int from, int to)Returns a type-specific view of the portion of this list from the indexfrom, inclusive, to the indexto, exclusive.-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntCollection
addAll, contains, containsAll, rem, removeAll, removeIf, removeIf, retainAll, toArray, toIntArray, toIntArray
-
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntIterable
forEach, forEach
-
-
-
-
Method Detail
-
iterator
IntListIterator iterator()
Returns a type-specific iterator on the elements of this list.Note that this specification strengthens the one given in
List.iterator(). It would not be normally necessary, butIterable.iterator()is bizarrily re-specified inList.- Specified by:
iteratorin interfacejava.util.Collection<java.lang.Integer>- Specified by:
iteratorin interfaceIntCollection- Specified by:
iteratorin interfaceIntIterable- Specified by:
iteratorin interfacejava.lang.Iterable<java.lang.Integer>- Specified by:
iteratorin interfacejava.util.List<java.lang.Integer>- Returns:
- an iterator on the elements of this list.
- See Also:
Iterable.iterator()
-
listIterator
IntListIterator listIterator()
Returns a type-specific list iterator on the list.- Specified by:
listIteratorin interfacejava.util.List<java.lang.Integer>- See Also:
List.listIterator()
-
listIterator
IntListIterator listIterator(int index)
Returns a type-specific list iterator on the list starting at a given index.- Specified by:
listIteratorin interfacejava.util.List<java.lang.Integer>- See Also:
List.listIterator(int)
-
subList
IntList subList(int from, int to)
Returns a type-specific view of the portion of this list from the indexfrom, inclusive, to the indexto, exclusive.Note that this specification strengthens the one given in
List.subList(int,int).- Specified by:
subListin interfacejava.util.List<java.lang.Integer>- See Also:
List.subList(int,int)
-
size
void size(int size)
Sets the size of this list.If the specified size is smaller than the current size, the last elements are discarded. Otherwise, they are filled with 0/
null/false.- Parameters:
size- the new size.
-
getElements
void getElements(int from, int[] a, int offset, int length)Copies (hopefully quickly) elements of this type-specific list into the given array.- Parameters:
from- the start index (inclusive).a- the destination array.offset- the offset into the destination array where to store the first element copied.length- the number of elements to be copied.
-
removeElements
void removeElements(int from, int to)Removes (hopefully quickly) elements of this type-specific list.- Parameters:
from- the start index (inclusive).to- the end index (exclusive).
-
addElements
void addElements(int index, int[] a)Add (hopefully quickly) elements to this type-specific list.- Parameters:
index- the index at which to add elements.a- the array containing the elements.
-
addElements
void addElements(int index, int[] a, int offset, int length)Add (hopefully quickly) elements to this type-specific list.- Parameters:
index- the index at which to add elements.a- the array containing the elements.offset- the offset of the first element to add.length- the number of elements to add.
-
add
boolean add(int key)
Appends the specified element to the end of this list (optional operation).- Specified by:
addin interfaceIntCollection- See Also:
List.add(Object)
-
add
void add(int index, int key)Inserts the specified element at the specified position in this list (optional operation).- See Also:
List.add(int,Object)
-
add
@Deprecated default void add(int index, java.lang.Integer key)Deprecated.Please use the corresponding type-specific method instead.- Specified by:
addin interfacejava.util.List<java.lang.Integer>
-
addAll
boolean addAll(int index, IntCollection c)Inserts all of the elements in the specified type-specific collection into this type-specific list at the specified position (optional operation).- See Also:
List.addAll(int,java.util.Collection)
-
addAll
boolean addAll(int index, IntList c)Inserts all of the elements in the specified type-specific list into this type-specific list at the specified position (optional operation).- See Also:
List.add(int,Object)
-
addAll
boolean addAll(IntList c)
Appends all of the elements in the specified type-specific list to the end of this type-specific list (optional operation).- See Also:
List.add(int,Object)
-
set
int set(int index, int k)Replaces the element at the specified position in this list with the specified element (optional operation).- See Also:
List.set(int,Object)
-
getInt
int getInt(int index)
Returns the element at the specified position in this list.- See Also:
List.get(int)
-
indexOf
int indexOf(int k)
Returns the index of the first occurrence of the specified element in this list, or -1 if this list does not contain the element.- See Also:
List.indexOf(Object)
-
lastIndexOf
int lastIndexOf(int k)
Returns the index of the last occurrence of the specified element in this list, or -1 if this list does not contain the element.- See Also:
List.lastIndexOf(Object)
-
contains
@Deprecated default boolean contains(java.lang.Object key)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
containsin interfacejava.util.Collection<java.lang.Integer>- Specified by:
containsin interfaceIntCollection- Specified by:
containsin interfacejava.util.List<java.lang.Integer>
-
get
@Deprecated default java.lang.Integer get(int index)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
getin interfacejava.util.List<java.lang.Integer>
-
indexOf
@Deprecated default int indexOf(java.lang.Object o)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
indexOfin interfacejava.util.List<java.lang.Integer>
-
lastIndexOf
@Deprecated default int lastIndexOf(java.lang.Object o)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
lastIndexOfin interfacejava.util.List<java.lang.Integer>
-
add
@Deprecated default boolean add(java.lang.Integer k)
Deprecated.Please use the corresponding type-specific method instead.This method specification is a workaround for bug 8177440.
- Specified by:
addin interfacejava.util.Collection<java.lang.Integer>- Specified by:
addin interfaceIntCollection- Specified by:
addin interfacejava.util.List<java.lang.Integer>
-
removeInt
int removeInt(int index)
Removes the element at the specified position in this list (optional operation).- See Also:
List.remove(int)
-
remove
@Deprecated default boolean remove(java.lang.Object key)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
removein interfacejava.util.Collection<java.lang.Integer>- Specified by:
removein interfaceIntCollection- Specified by:
removein interfacejava.util.List<java.lang.Integer>
-
remove
@Deprecated default java.lang.Integer remove(int index)
Deprecated.Please use the corresponding type-specific method instead.- Specified by:
removein interfacejava.util.List<java.lang.Integer>
-
set
@Deprecated default java.lang.Integer set(int index, java.lang.Integer k)Deprecated.Please use the corresponding type-specific method instead.- Specified by:
setin interfacejava.util.List<java.lang.Integer>
-
-