it.unimi.dsi.fastutil.longs
Class LongSets.Singleton

java.lang.Object
  extended byit.unimi.dsi.fastutil.longs.AbstractLongCollection
      extended byit.unimi.dsi.fastutil.longs.AbstractLongSet
          extended byit.unimi.dsi.fastutil.longs.LongSets.Singleton
All Implemented Interfaces:
Cloneable, Collection, LongCollection, LongSet, Serializable, Set
Direct Known Subclasses:
LongSortedSets.Singleton
Enclosing class:
LongSets

public static class LongSets.Singleton
extends AbstractLongSet
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(long k)
           
 boolean addAll(Collection c)
          Adds all elements of the given collection to this collection.
 boolean addAll(List l)
           
 boolean addAll(LongCollection c)
          Adds all elements of the given type-specific collection to this collection.
 boolean addAll(LongList l)
           
 Object clone()
           
 boolean contains(long k)
           
 LongIterator longIterator()
          Returns a type-specific iterator on the collection.
 boolean removeAll(Collection c)
          Remove from this collection all elements in the given collection.
 boolean removeAll(LongCollection 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(LongCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 long[] toLongArray()
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongSet
equals, hashCode, iterator, rem, remove, remove
 
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, clear, contains, containsAll, containsAll, isEmpty, iterator, rem, toArray, toArray, toArray, toLongArray, 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.longs.LongCollection
containsAll, toArray, toLongArray
 

Field Detail

serialVersionUID

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

add

public boolean add(long k)
Specified by:
add in interface LongCollection
Overrides:
add in class AbstractLongCollection

contains

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

addAll

public boolean addAll(List l)

addAll

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

Specified by:
addAll in interface Set
Overrides:
addAll in class AbstractLongCollection
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: AbstractLongCollection
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 AbstractLongCollection
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: AbstractLongCollection
Retains in this collection only elements from the given collection.

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

addAll

public boolean addAll(LongList l)

addAll

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

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

removeAll

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

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

retainAll

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

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

toLongArray

public long[] toLongArray()
Description copied from interface: LongCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toLongArray in interface LongCollection
Overrides:
toLongArray in class AbstractLongCollection

longIterator

public LongIterator longIterator()
Description copied from interface: LongCollection
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:
longIterator in interface LongCollection
See Also:
Collection.iterator()

size

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

clone

public Object clone()