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

java.lang.Object
  extended by java.util.AbstractCollection<Long>
      extended by it.unimi.dsi.fastutil.longs.AbstractLongCollection
          extended by it.unimi.dsi.fastutil.longs.LongCollections.EmptyCollection
All Implemented Interfaces:
LongCollection, LongIterable, Iterable<Long>, Collection<Long>
Direct Known Subclasses:
LongBigLists.EmptyBigList, 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.


Constructor Summary
protected LongCollections.EmptyCollection()
           
 
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(Object o)
           
 int hashCode()
           
 LongBidirectionalIterator 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()
           
 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
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongCollections.EmptyCollection

protected LongCollections.EmptyCollection()
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
Overrides:
contains in class AbstractLongCollection
See Also:
Collection.contains(Object)

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<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 LongBidirectionalIterator 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 Iterable<Long>
Specified by:
iterator in interface Collection<Long>
Specified by:
iterator in class AbstractLongCollection
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 class AbstractCollection<Long>

clear

public void clear()
Specified by:
clear in interface Collection<Long>
Overrides:
clear in class AbstractCollection<Long>

hashCode

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

equals

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


Copyright © 2011. All Rights Reserved.