it.unimi.dsi.fastutil.longs
Class LongCollections.EmptyCollection

java.lang.Object
  extended by it.unimi.dsi.fastutil.longs.AbstractLongCollection
      extended by it.unimi.dsi.fastutil.longs.LongCollections.EmptyCollection
All Implemented Interfaces:
LongCollection, LongIterable, java.lang.Iterable<java.lang.Long>, java.util.Collection<java.lang.Long>
Direct Known Subclasses:
LongLists.EmptyList, LongSets.EmptySet
Enclosing class:
LongCollections

public abstract static class LongCollections.EmptyCollection
extends AbstractLongCollection

An immutable class representing an empty type-specific collection.

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


Method Summary
 boolean add(long k)
           
 boolean addAll(LongCollection c)
          Adds all elements of the given type-specific collection to this collection.
 void clear()
           
 boolean contains(long k)
           
 boolean containsAll(LongCollection c)
          Checks whether this collection contains all elements from the given type-specific collection.
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 LongListIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean rem(long 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(LongCollection c)
          Remove from this collection all elements in the given type-specific collection.
 boolean retainAll(LongCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 java.lang.Object[] toArray()
           
 long[] toLongArray()
          Returns a primitive type array containing the items of this collection.
 long[] toLongArray(long[] a)
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.longs.AbstractLongCollection
add, addAll, contains, containsAll, isEmpty, longIterator, rem, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

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

toArray

public java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<java.lang.Long>
Overrides:
toArray in class AbstractLongCollection

toLongArray

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

Note that, contrarily to Collection.toArray(Object[]), this methods just writes all elements of this collection: no special value will be added after the last one.

Specified by:
toLongArray in interface LongCollection
Overrides:
toLongArray in class AbstractLongCollection
Parameters:
a - if this array is big enough, it will be used to store this collection.
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray(Object[])

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()

rem

public boolean rem(long k)
Description copied from interface: LongCollection
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 LongCollection
Overrides:
rem in class AbstractLongCollection
See Also:
Collection.remove(Object)

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)

containsAll

public boolean containsAll(LongCollection c)
Description copied from class: AbstractLongCollection
Checks whether this collection contains all elements from the given type-specific collection.

Specified by:
containsAll in interface LongCollection
Overrides:
containsAll in class AbstractLongCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection contains all elements of the argument.
See Also:
Collection.containsAll(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 java.lang.Iterable<java.lang.Long>
Specified by:
iterator in interface java.util.Collection<java.lang.Long>
Specified by:
iterator in class AbstractLongCollection
Returns:
a type-specific iterator on the elements of this collection.

size

public int size()

clear

public void clear()
Specified by:
clear in interface java.util.Collection<java.lang.Long>
Overrides:
clear in class AbstractLongCollection

hashCode

public int hashCode()
Specified by:
hashCode in interface java.util.Collection<java.lang.Long>
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
Specified by:
equals in interface java.util.Collection<java.lang.Long>
Overrides:
equals in class java.lang.Object