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

java.lang.Object
  extended byit.unimi.dsi.fastutil.ints.AbstractIntCollection
      extended byit.unimi.dsi.fastutil.ints.AbstractIntList
          extended byit.unimi.dsi.fastutil.ints.IntLists.Singleton
All Implemented Interfaces:
Cloneable, Collection, Comparable, IntCollection, IntList, IntStack, List, Serializable, Stack
Enclosing class:
IntLists

public static class IntLists.Singleton
extends AbstractIntList
implements Serializable, Cloneable

An immutable class representing a type-specific singleton list.

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

See Also:
Serialized Form

Nested Class Summary
 
Nested classes inherited from class it.unimi.dsi.fastutil.ints.AbstractIntList
AbstractIntList.IntSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(int k)
           
 void add(int i, int k)
           
 boolean addAll(Collection c)
          Delegates to a more generic method.
 boolean addAll(IntCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection c)
           
 boolean addAll(int i, IntCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, IntList c)
          Delegates to a more generic method.
 boolean addAll(IntList c)
          Delegates to a more generic method.
 boolean addAll(int i, List c)
           
 boolean addAll(List c)
           
 void clear()
           
 Object clone()
           
 boolean contains(int k)
           
 int getInt(int i)
           
 IntListIterator intListIterator()
          Delegates to the corresponding list-iterator method.
 IntListIterator intListIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 IntList intSubList(int from, int to)
           
 boolean rem(int k)
          Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name.
 boolean removeAll(Collection c)
          Remove from this collection all elements in the given collection.
 boolean removeAll(IntCollection c)
          Remove from this collection all elements in the given type-specific collection.
 int removeInt(int i)
           
 boolean retainAll(Collection c)
          Retains in this collection only elements from the given collection.
 boolean retainAll(IntCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 void size(int size)
          Sets the size of this list.
 int[] toIntArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntList
add, addElements, addElements, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, intIterator, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekInt, pop, popInt, push, push, remove, removeElements, set, set, subList, top, topInt, toString
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntCollection
add, contains, containsAll, containsAll, isEmpty, iterator, rem, remove, toArray, toArray, toArray, toIntArray
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
add, contains, containsAll, isEmpty, iterator, remove, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntCollection
containsAll, toArray, toIntArray
 
Methods inherited from interface it.unimi.dsi.fastutil.Stack
isEmpty
 

Field Detail

serialVersionUID

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

rem

public boolean rem(int k)
Description copied from interface: IntCollection
Note that this method should be called remove(), but the clash with the similarly named index-based method in the List interface forces us to use a distinguished name. For simplicity, the set interfaces reinstates remove().

Specified by:
rem in interface IntCollection
Overrides:
rem in class AbstractIntList

add

public boolean add(int k)
Specified by:
add in interface IntCollection
Overrides:
add in class AbstractIntList

add

public void add(int i,
                int k)
Specified by:
add in interface IntList
Overrides:
add in class AbstractIntList

getInt

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

removeInt

public int removeInt(int i)
Specified by:
removeInt in interface IntList
Overrides:
removeInt in class AbstractIntList

contains

public boolean contains(int k)
Specified by:
contains in interface IntCollection
Overrides:
contains in class AbstractIntList

addAll

public boolean addAll(IntList c)
Description copied from class: AbstractIntList
Delegates to a more generic method.

Specified by:
addAll in interface IntList
Overrides:
addAll in class AbstractIntList

addAll

public boolean addAll(IntCollection c)
Description copied from class: AbstractIntList
Delegates to a more generic method.

Specified by:
addAll in interface IntCollection
Overrides:
addAll in class AbstractIntList

addAll

public boolean addAll(int i,
                      IntList c)
Description copied from class: AbstractIntList
Delegates to a more generic method.

Specified by:
addAll in interface IntList
Overrides:
addAll in class AbstractIntList

addAll

public boolean addAll(int i,
                      IntCollection c)
Description copied from class: AbstractIntList
Delegates to a more generic method.

Specified by:
addAll in interface IntList
Overrides:
addAll in class AbstractIntList

removeAll

public boolean removeAll(IntCollection c)
Description copied from class: AbstractIntCollection
Remove from this collection all elements in the given type-specific collection.

Specified by:
removeAll in interface IntCollection
Overrides:
removeAll in class AbstractIntCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(IntCollection c)
Description copied from class: AbstractIntCollection
Retains in this collection only elements from the given type-specific collection.

Specified by:
retainAll in interface IntCollection
Overrides:
retainAll in class AbstractIntCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection changed as a result of the call.

addAll

public boolean addAll(List c)

addAll

public boolean addAll(Collection c)
Description copied from class: AbstractIntList
Delegates to a more generic method.

Specified by:
addAll in interface List
Overrides:
addAll in class AbstractIntList

addAll

public boolean addAll(int i,
                      List c)

addAll

public boolean addAll(int i,
                      Collection c)
Specified by:
addAll in interface List
Overrides:
addAll in class AbstractIntList

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 List
Overrides:
removeAll in class AbstractIntCollection
Parameters:
c - a collection.
Returns:
true if this collection changed as a result of the call.

retainAll

public boolean retainAll(Collection c)
Description copied from class: AbstractIntCollection
Retains in this collection only elements from the given collection.

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

toIntArray

public int[] toIntArray()
Description copied from interface: IntCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toIntArray in interface IntCollection
Overrides:
toIntArray in class AbstractIntCollection

intListIterator

public IntListIterator intListIterator()
Description copied from class: AbstractIntList
Delegates to the corresponding list-iterator method.

Specified by:
intListIterator in interface IntList
Overrides:
intListIterator in class AbstractIntList

intListIterator

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

The iterator returned by the List.listIterator() method and by this method are identical; however, using this method you can save a type casting.

Specified by:
intListIterator in interface IntList
Overrides:
intListIterator in class AbstractIntList

intSubList

public IntList intSubList(int from,
                          int to)
Specified by:
intSubList in interface IntList
Overrides:
intSubList in class AbstractIntList

size

public int size()
Specified by:
size in interface List

size

public void size(int size)
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
Overrides:
size in class AbstractIntList

clear

public void clear()
Specified by:
clear in interface List
Overrides:
clear in class AbstractIntCollection

clone

public Object clone()