it.unimi.dsi.fastutil.ints
Class IntLists.EmptyList

java.lang.Object
  extended by java.util.AbstractCollection<Integer>
      extended by it.unimi.dsi.fastutil.ints.AbstractIntCollection
          extended by it.unimi.dsi.fastutil.ints.IntCollections.EmptyCollection
              extended by it.unimi.dsi.fastutil.ints.IntLists.EmptyList
All Implemented Interfaces:
IntCollection, IntIterable, IntList, Serializable, Cloneable, Comparable<List<? extends Integer>>, Iterable<Integer>, Collection<Integer>, List<Integer>
Enclosing class:
IntLists

public static class IntLists.EmptyList
extends IntCollections.EmptyCollection
implements IntList, Serializable, Cloneable

An immutable class representing an empty type-specific list.

This class may be useful to implement your own in case you subclass a type-specific list.

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(int k)
           
 boolean add(Integer k)
          Delegates to the corresponding type-specific method.
 void add(int index, int k)
           
 void add(int index, Integer k)
           
 boolean addAll(Collection<? extends Integer> c)
          Adds all elements of the given collection to this collection.
 boolean addAll(IntCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(int i, Collection<? extends Integer> c)
           
 boolean addAll(int i, IntCollection c)
           
 boolean addAll(int i, IntList c)
           
 boolean addAll(IntList c)
           
 void addElements(int index, int[] a)
          Add (hopefully quickly) elements to this type-specific list.
 void addElements(int index, int[] a, int offset, int length)
          Add (hopefully quickly) elements to this type-specific list.
 Object clone()
           
 int compareTo(List<? extends Integer> o)
           
 Integer get(int i)
           
 void getElements(int from, int[] a, int offset, int length)
          Copies (hopefully quickly) elements of this type-specific list into the given array.
 int getInt(int i)
           
 int indexOf(int k)
           
 int indexOf(Object k)
           
 IntIterator intIterator()
          Deprecated. 
 IntListIterator intListIterator()
          Deprecated. 
 IntListIterator intListIterator(int i)
          Deprecated. 
 IntList intSubList(int from, int to)
          Deprecated. 
 IntListIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 int lastIndexOf(int k)
           
 int lastIndexOf(Object k)
           
 IntListIterator listIterator()
          Returns a type-specific list iterator on the list.
 IntListIterator listIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 Integer remove(int k)
           
 boolean removeAll(Collection<?> c)
          Remove from this collection all elements in the given collection.
 void removeElements(int from, int to)
          Removes (hopefully quickly) elements of this type-specific list.
 int removeInt(int i)
           
 int set(int index, int k)
           
 Integer set(int index, Integer k)
           
 void size(int s)
          Sets the size of this list.
 IntList subList(int from, int to)
          Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.
 
Methods inherited from class it.unimi.dsi.fastutil.ints.IntCollections.EmptyCollection
clear, contains, containsAll, equals, hashCode, rem, removeAll, retainAll, size, toArray, toIntArray, toIntArray
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntCollection
contains, containsAll, isEmpty, rem, remove, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
clear, contains, containsAll, equals, hashCode, isEmpty, remove, retainAll, size, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntCollection
contains, containsAll, rem, removeAll, retainAll, toArray, toArray, toIntArray, toIntArray
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values
Method Detail

add

public void add(int index,
                int k)
Specified by:
add in interface IntList
See Also:
List.add(int,Object)

add

public boolean add(int k)
Specified by:
add in interface IntCollection
Specified by:
add in interface IntList
Overrides:
add in class IntCollections.EmptyCollection
See Also:
Collection.add(Object)

removeInt

public int removeInt(int i)
Specified by:
removeInt in interface IntList
See Also:
List.remove(int)

set

public int set(int index,
               int k)
Specified by:
set in interface IntList
See Also:
List.set(int,Object)

indexOf

public int indexOf(int k)
Specified by:
indexOf in interface IntList
See Also:
List.indexOf(Object)

lastIndexOf

public int lastIndexOf(int k)
Specified by:
lastIndexOf in interface IntList
See Also:
List.lastIndexOf(Object)

addAll

public boolean addAll(Collection<? extends Integer> c)
Description copied from class: AbstractIntCollection
Adds all elements of the given collection to this collection.

Specified by:
addAll in interface Collection<Integer>
Specified by:
addAll in interface List<Integer>
Overrides:
addAll in class AbstractIntCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(int i,
                      Collection<? extends Integer> c)
Specified by:
addAll in interface List<Integer>

removeAll

public boolean removeAll(Collection<?> c)
Description copied from class: AbstractIntCollection
Remove from this collection all elements in the given collection. If the collection is an instance of this class, it uses faster iterators.

Specified by:
removeAll in interface Collection<Integer>
Specified by:
removeAll in interface List<Integer>
Overrides:
removeAll in class AbstractIntCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

get

public Integer get(int i)
Specified by:
get in interface List<Integer>

addAll

public boolean addAll(IntCollection c)
Description copied from class: AbstractIntCollection
Adds all elements of the given type-specific collection to this collection.

Specified by:
addAll in interface IntCollection
Overrides:
addAll in class IntCollections.EmptyCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.
See Also:
Collection.addAll(Collection)

addAll

public boolean addAll(IntList c)
Specified by:
addAll in interface IntList
See Also:
List.add(int,Object)

addAll

public boolean addAll(int i,
                      IntCollection c)
Specified by:
addAll in interface IntList
See Also:
List.add(int,Object)

addAll

public boolean addAll(int i,
                      IntList c)
Specified by:
addAll in interface IntList
See Also:
List.add(int,Object)

add

public void add(int index,
                Integer k)
Specified by:
add in interface List<Integer>

add

public boolean add(Integer k)
Description copied from class: AbstractIntCollection
Delegates to the corresponding type-specific method.

Specified by:
add in interface Collection<Integer>
Specified by:
add in interface List<Integer>
Overrides:
add in class AbstractIntCollection

set

public Integer set(int index,
                   Integer k)
Specified by:
set in interface List<Integer>

getInt

public int getInt(int i)
Specified by:
getInt in interface IntList
See Also:
List.get(int)

remove

public Integer remove(int k)
Specified by:
remove in interface List<Integer>

indexOf

public int indexOf(Object k)
Specified by:
indexOf in interface List<Integer>

lastIndexOf

public int lastIndexOf(Object k)
Specified by:
lastIndexOf in interface List<Integer>

intIterator

@Deprecated
public IntIterator intIterator()
Deprecated. 

Description copied from class: AbstractIntCollection
Delegates to the new covariantly stronger generic method.

Specified by:
intIterator in interface IntCollection
Overrides:
intIterator in class AbstractIntCollection
See Also:
IntCollection.iterator()

listIterator

public IntListIterator listIterator()
Description copied from interface: IntList
Returns a type-specific list iterator on the list.

Specified by:
listIterator in interface IntList
Specified by:
listIterator in interface List<Integer>
See Also:
List.listIterator()

iterator

public IntListIterator iterator()
Description copied from interface: IntCollection
Returns a type-specific iterator on the elements of this collection.

Note that this specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Collection.

Specified by:
iterator in interface IntCollection
Specified by:
iterator in interface IntIterable
Specified by:
iterator in interface IntList
Specified by:
iterator in interface Iterable<Integer>
Specified by:
iterator in interface Collection<Integer>
Specified by:
iterator in interface List<Integer>
Overrides:
iterator in class IntCollections.EmptyCollection
Returns:
a type-specific iterator on the elements of this collection.

listIterator

public IntListIterator listIterator(int i)
Description copied from interface: IntList
Returns a type-specific list iterator on the list starting at a given index.

Specified by:
listIterator in interface IntList
Specified by:
listIterator in interface List<Integer>
See Also:
List.listIterator(int)

intListIterator

@Deprecated
public IntListIterator intListIterator()
Deprecated. 

Description copied from interface: IntList
Returns a type-specific list iterator on the list.

Specified by:
intListIterator in interface IntList
See Also:
IntList.listIterator()

intListIterator

@Deprecated
public IntListIterator intListIterator(int i)
Deprecated. 

Description copied from interface: IntList
Returns a type-specific list iterator on the list starting at a given index.

Specified by:
intListIterator in interface IntList
See Also:
IntList.listIterator(int)

subList

public IntList subList(int from,
                       int to)
Description copied from interface: IntList
Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.

Note that this specification strengthens the one given in List.subList(int,int).

Specified by:
subList in interface IntList
Specified by:
subList in interface List<Integer>
See Also:
List.subList(int,int)

intSubList

@Deprecated
public IntList intSubList(int from,
                                     int to)
Deprecated. 

Description copied from interface: IntList
Returns a type-specific view of the portion of this list from the index from, inclusive, to the index to, exclusive.

Specified by:
intSubList in interface IntList
See Also:
List.subList(int,int)

getElements

public void getElements(int from,
                        int[] a,
                        int offset,
                        int length)
Description copied from interface: IntList
Copies (hopefully quickly) elements of this type-specific list into the given array.

Specified by:
getElements in interface IntList
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

public void removeElements(int from,
                           int to)
Description copied from interface: IntList
Removes (hopefully quickly) elements of this type-specific list.

Specified by:
removeElements in interface IntList
Parameters:
from - the start index (inclusive).
to - the end index (exclusive).

addElements

public void addElements(int index,
                        int[] a,
                        int offset,
                        int length)
Description copied from interface: IntList
Add (hopefully quickly) elements to this type-specific list.

Specified by:
addElements in interface IntList
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.

addElements

public void addElements(int index,
                        int[] a)
Description copied from interface: IntList
Add (hopefully quickly) elements to this type-specific list.

Specified by:
addElements in interface IntList
Parameters:
index - the index at which to add elements.
a - the array containing the elements.

size

public void size(int s)
Description copied from interface: IntList
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.

Specified by:
size in interface IntList
Parameters:
s - the new size.

compareTo

public int compareTo(List<? extends Integer> o)
Specified by:
compareTo in interface Comparable<List<? extends Integer>>

clone

public Object clone()
Overrides:
clone in class Object