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

java.lang.Object
  extended byit.unimi.dsi.fastutil.shorts.AbstractShortCollection
      extended byit.unimi.dsi.fastutil.shorts.AbstractShortSet
          extended byit.unimi.dsi.fastutil.shorts.ShortSets.Singleton
All Implemented Interfaces:
Cloneable, Collection, Serializable, Set, ShortCollection, ShortSet
Direct Known Subclasses:
ShortSortedSets.Singleton
Enclosing class:
ShortSets

public static class ShortSets.Singleton
extends AbstractShortSet
implements Serializable, Cloneable

An immutable class representing a type-specific singleton set.

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

See Also:
Serialized Form

Field Summary
static long serialVersionUID
           
 
Method Summary
 boolean add(short k)
           
 boolean addAll(Collection c)
          Adds all elements of the given collection to this collection.
 boolean addAll(List l)
           
 boolean addAll(ShortCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(ShortList l)
           
 Object clone()
           
 boolean contains(short k)
           
 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.
 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.
 ShortIterator shortIterator()
          Returns a type-specific iterator on the collection.
 int size()
           
 short[] toShortArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortSet
equals, hashCode, iterator, rem, remove, remove
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
add, clear, contains, containsAll, containsAll, isEmpty, iterator, rem, toArray, toArray, toArray, toShortArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
add, clear, contains, containsAll, isEmpty, iterator, toArray, toArray
 
Methods inherited from interface it.unimi.dsi.fastutil.shorts.ShortCollection
containsAll, toArray, toShortArray
 

Field Detail

serialVersionUID

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

add

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

contains

public boolean contains(short k)
Specified by:
contains in interface ShortCollection
See Also:
Collection.contains(Object)

addAll

public boolean addAll(List l)

addAll

public boolean addAll(Collection c)
Description copied from class: AbstractShortCollection
Adds all elements of the given collection to this collection.

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

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

addAll

public boolean addAll(ShortList l)

addAll

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

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

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.

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

shortIterator

public ShortIterator shortIterator()
Description copied from interface: ShortCollection
Returns a type-specific iterator on the collection.

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

Specified by:
shortIterator in interface ShortCollection
See Also:
Collection.iterator()

size

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

clone

public Object clone()