it.unimi.dsi.fastutil.shorts
Class ShortLists.Singleton

java.lang.Object
  extended byit.unimi.dsi.fastutil.shorts.AbstractShortCollection
      extended byit.unimi.dsi.fastutil.shorts.AbstractShortList
          extended byit.unimi.dsi.fastutil.shorts.ShortLists.Singleton
All Implemented Interfaces:
Cloneable, Collection, Comparable, List, Serializable, ShortCollection, ShortList, ShortStack, Stack
Enclosing class:
ShortLists

public static class ShortLists.Singleton
extends AbstractShortList
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.shorts.AbstractShortList
AbstractShortList.ShortSubList
 
Field Summary
static long serialVersionUID
           
 
Method Summary
 void add(int i, short k)
           
 boolean add(short k)
           
 boolean addAll(Collection c)
          Delegates to a more generic method.
 boolean addAll(int i, Collection c)
           
 boolean addAll(int i, List c)
           
 boolean addAll(int i, ShortCollection c)
          Delegates to a more generic method.
 boolean addAll(int i, ShortList c)
          Delegates to a more generic method.
 boolean addAll(List c)
           
 boolean addAll(ShortCollection c)
          Delegates to a more generic method.
 boolean addAll(ShortList c)
          Delegates to a more generic method.
 void clear()
           
 Object clone()
           
 boolean contains(short k)
           
 short getShort(int i)
           
 boolean rem(short 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(ShortCollection c)
          Remove from this collection all elements in the given type-specific collection.
 short removeShort(int i)
           
 boolean retainAll(Collection c)
          Retains in this collection only elements from the given collection.
 boolean retainAll(ShortCollection c)
          Retains in this collection only elements from the given type-specific collection.
 ShortListIterator shortListIterator()
          Delegates to the corresponding list-iterator method.
 ShortListIterator shortListIterator(int i)
          Returns a type-specific list iterator on the list starting at a given index.
 ShortList shortSubList(int from, int to)
           
 int size()
           
 void size(int size)
          Sets the size of this list.
 short[] toShortArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortList
add, addElements, addElements, compareTo, equals, get, getElements, hashCode, indexOf, indexOf, lastIndexOf, lastIndexOf, listIterator, listIterator, peek, peekShort, pop, popShort, push, push, remove, removeElements, set, set, shortIterator, subList, top, topShort, toString
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
add, contains, containsAll, containsAll, isEmpty, iterator, rem, remove, toArray, toArray, toArray, toShortArray
 
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.shorts.ShortCollection
containsAll, toArray, toShortArray
 
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(short k)
Description copied from interface: ShortCollection
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 ShortCollection
Overrides:
rem in class AbstractShortList

add

public boolean add(short k)
Specified by:
add in interface ShortCollection
Overrides:
add in class AbstractShortList

add

public void add(int i,
                short k)
Specified by:
add in interface ShortList
Overrides:
add in class AbstractShortList

getShort

public short getShort(int i)
Specified by:
getShort in interface ShortList
See Also:
List.get(int)

removeShort

public short removeShort(int i)
Specified by:
removeShort in interface ShortList
Overrides:
removeShort in class AbstractShortList

contains

public boolean contains(short k)
Specified by:
contains in interface ShortCollection
Overrides:
contains in class AbstractShortList

addAll

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

Specified by:
addAll in interface ShortList
Overrides:
addAll in class AbstractShortList

addAll

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

Specified by:
addAll in interface ShortCollection
Overrides:
addAll in class AbstractShortList

addAll

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

Specified by:
addAll in interface ShortList
Overrides:
addAll in class AbstractShortList

addAll

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

Specified by:
addAll in interface ShortList
Overrides:
addAll in class AbstractShortList

removeAll

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

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

retainAll

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

Specified by:
retainAll in interface ShortCollection
Overrides:
retainAll in class AbstractShortCollection
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: AbstractShortList
Delegates to a more generic method.

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

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 AbstractShortList

removeAll

public boolean removeAll(Collection c)
Description copied from class: AbstractShortCollection
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 AbstractShortCollection
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: AbstractShortCollection
Retains in this collection only elements from the given collection.

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

toShortArray

public short[] toShortArray()
Description copied from interface: ShortCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toShortArray in interface ShortCollection
Overrides:
toShortArray in class AbstractShortCollection

shortListIterator

public ShortListIterator shortListIterator()
Description copied from class: AbstractShortList
Delegates to the corresponding list-iterator method.

Specified by:
shortListIterator in interface ShortList
Overrides:
shortListIterator in class AbstractShortList

shortListIterator

public ShortListIterator shortListIterator(int i)
Description copied from interface: ShortList
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:
shortListIterator in interface ShortList
Overrides:
shortListIterator in class AbstractShortList

shortSubList

public ShortList shortSubList(int from,
                              int to)
Specified by:
shortSubList in interface ShortList
Overrides:
shortSubList in class AbstractShortList

size

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

size

public void size(int size)
Description copied from interface: ShortList
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 ShortList
Overrides:
size in class AbstractShortList

clear

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

clone

public Object clone()