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

java.lang.Object
  extended by it.unimi.dsi.fastutil.ints.AbstractIntCollection
      extended by it.unimi.dsi.fastutil.ints.AbstractIntList
          extended by it.unimi.dsi.fastutil.ints.IntLists.Singleton
All Implemented Interfaces:
IntCollection, IntIterable, IntList, IntStack, Stack<java.lang.Integer>, java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<java.util.List<? extends java.lang.Integer>>, java.lang.Iterable<java.lang.Integer>, java.util.Collection<java.lang.Integer>, java.util.List<java.lang.Integer>
Enclosing class:
IntLists

public static class IntLists.Singleton
extends AbstractIntList
implements java.io.Serializable, java.lang.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/interfaces inherited from class it.unimi.dsi.fastutil.ints.AbstractIntList
AbstractIntList.IntSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean addAll(java.util.Collection<? extends java.lang.Integer> c)
          Delegates to a more generic method.
 boolean addAll(IntCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(int i, java.util.Collection<? extends java.lang.Integer> c)
           
 boolean addAll(int i, IntCollection c)
          Delegates to a more generic method.
 void clear()
           
 java.lang.Object clone()
           
 boolean contains(int k)
           
 int getInt(int i)
           
 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.
 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(java.util.Collection<?> c)
          Remove from this collection all elements in the given collection.
 int removeInt(int i)
           
 boolean retainAll(java.util.Collection<?> c)
          Retains in this collection only elements from the given collection.
 int size()
           
 void size(int size)
          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.
 int[] toIntArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntList
add, add, add, addAll, addAll, addElements, addElements, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, intListIterator, intListIterator, intSubList, iterator, lastIndexOf, lastIndexOf, peek, peekInt, pop, popInt, push, push, remove, remove, removeElements, set, set, top, topInt, toString
 
Methods inherited from class it.unimi.dsi.fastutil.ints.AbstractIntCollection
add, contains, containsAll, containsAll, intIterator, isEmpty, rem, removeAll, retainAll, 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, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.ints.IntCollection
containsAll, intIterator, removeAll, retainAll, toArray, 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

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
See Also:
List.remove(int)

contains

public boolean contains(int k)
Specified by:
contains in interface IntCollection
Overrides:
contains in class AbstractIntList
See Also:
Collection.contains(Object)

addAll

public boolean addAll(java.util.Collection<? extends java.lang.Integer> c)
Description copied from class: AbstractIntList
Delegates to a more generic method.

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

addAll

public boolean addAll(int i,
                      java.util.Collection<? extends java.lang.Integer> c)
Specified by:
addAll in interface java.util.List<java.lang.Integer>
Overrides:
addAll in class AbstractIntList

removeAll

public boolean removeAll(java.util.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 java.util.Collection<java.lang.Integer>
Specified by:
removeAll in interface java.util.List<java.lang.Integer>
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(java.util.Collection<?> c)
Description copied from class: AbstractIntCollection
Retains in this collection only elements from the given collection.

Specified by:
retainAll in interface java.util.Collection<java.lang.Integer>
Specified by:
retainAll in interface java.util.List<java.lang.Integer>
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
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

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 java.util.List<java.lang.Integer>
Overrides:
listIterator in class AbstractIntList
See Also:
IntList.listIterator()

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 java.util.List<java.lang.Integer>
Overrides:
listIterator in class AbstractIntList
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 java.util.List<java.lang.Integer>
Overrides:
subList in class AbstractIntList
See Also:
List.subList(int,int)

size

public int size()
Specified by:
size in interface java.util.Collection<java.lang.Integer>
Specified by:
size in interface java.util.List<java.lang.Integer>

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
Parameters:
size - the new size.

clear

public void clear()
Specified by:
clear in interface java.util.Collection<java.lang.Integer>
Specified by:
clear in interface java.util.List<java.lang.Integer>
Overrides:
clear in class AbstractIntCollection

clone

public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

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
See Also:
Collection.remove(Object)

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 AbstractIntList
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(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
See Also:
List.add(int,Object)