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

java.lang.Object
  extended by it.unimi.dsi.fastutil.longs.AbstractLongCollection
      extended by it.unimi.dsi.fastutil.longs.AbstractLongSet
          extended by it.unimi.dsi.fastutil.longs.LongSets.Singleton
All Implemented Interfaces:
LongCollection, LongIterable, LongSet, Serializable, Cloneable, Iterable<Long>, Collection<Long>, Set<Long>
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<? extends Long> c)
          Adds all elements of the given collection to this collection.
 boolean addAll(LongCollection c)
          Adds all elements of the given type-specific collection to this collection.
 Object clone()
           
 boolean contains(long k)
           
 LongListIterator iterator()
          Returns a type-specific iterator on the elements of this 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, rem, remove, remove
 
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, clear, contains, containsAll, containsAll, isEmpty, longIterator, rem, toArray, toArray, toArray, toLongArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface it.unimi.dsi.fastutil.longs.LongCollection
containsAll, longIterator, toArray, toArray, toLongArray
 
Methods inherited from interface java.util.Set
add, clear, contains, containsAll, isEmpty, toArray, toArray
 

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

contains

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

addAll

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

Specified by:
addAll in interface Collection<Long>
Specified by:
addAll in interface Set<Long>
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 Collection<Long>
Specified by:
removeAll in interface Set<Long>
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 Collection<Long>
Specified by:
retainAll in interface Set<Long>
Overrides:
retainAll in class AbstractLongCollection
Parameters:
c - a 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
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

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

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

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

iterator

public LongListIterator iterator()
Description copied from interface: LongCollection
Returns a type-specific iterator on the elements of this collection.

Note that this specification strengthens the one given in Iterable.iterator(), which was already strengthened in the corresponding type-specific class, but was weakened by the fact that this interface extends Collection.

Specified by:
iterator in interface LongCollection
Specified by:
iterator in interface LongIterable
Specified by:
iterator in interface LongSet
Specified by:
iterator in interface Iterable<Long>
Specified by:
iterator in interface Collection<Long>
Specified by:
iterator in interface Set<Long>
Specified by:
iterator in class AbstractLongSet
Returns:
a type-specific iterator on the elements of this collection.

size

public int size()
Specified by:
size in interface Collection<Long>
Specified by:
size in interface Set<Long>

clone

public Object clone()
Overrides:
clone in class Object