it.unimi.dsi.fastutil.objects
Class ReferenceCollections.EmptyCollection<K>

java.lang.Object
  extended by java.util.AbstractCollection<K>
      extended by it.unimi.dsi.fastutil.objects.AbstractReferenceCollection<K>
          extended by it.unimi.dsi.fastutil.objects.ReferenceCollections.EmptyCollection<K>
All Implemented Interfaces:
ObjectIterable<K>, ReferenceCollection<K>, Iterable<K>, Collection<K>
Direct Known Subclasses:
ReferenceBigLists.EmptyBigList, ReferenceLists.EmptyList, ReferenceSets.EmptySet
Enclosing class:
ReferenceCollections

public abstract static class ReferenceCollections.EmptyCollection<K>
extends AbstractReferenceCollection<K>

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 ReferenceCollections.EmptyCollection()
           
 
Method Summary
 boolean add(K k)
           
 void clear()
           
 boolean contains(Object k)
           
 boolean equals(Object o)
           
 int hashCode()
           
 ObjectBidirectionalIterator<K> iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean remove(Object k)
           
 int size()
           
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
          Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.
 
Methods inherited from class it.unimi.dsi.fastutil.objects.AbstractReferenceCollection
addAll, containsAll, isEmpty, objectIterator, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ReferenceCollections.EmptyCollection

protected ReferenceCollections.EmptyCollection()
Method Detail

add

public boolean add(K k)
Specified by:
add in interface Collection<K>
Overrides:
add in class AbstractReferenceCollection<K>

contains

public boolean contains(Object k)
Specified by:
contains in interface Collection<K>
Overrides:
contains in class AbstractCollection<K>

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<K>
Overrides:
toArray in class AbstractReferenceCollection<K>

remove

public boolean remove(Object k)
Specified by:
remove in interface Collection<K>
Overrides:
remove in class AbstractCollection<K>

toArray

public <T> T[] toArray(T[] a)
Description copied from interface: ReferenceCollection
Returns an containing the items of this collection; the runtime type of the returned array is that of the specified array.

Warning: 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:
toArray in interface ReferenceCollection<K>
Specified by:
toArray in interface Collection<K>
Overrides:
toArray in class AbstractReferenceCollection<K>
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[])

iterator

public ObjectBidirectionalIterator<K> iterator()
Description copied from interface: ReferenceCollection
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 ObjectIterable<K>
Specified by:
iterator in interface ReferenceCollection<K>
Specified by:
iterator in interface Iterable<K>
Specified by:
iterator in interface Collection<K>
Specified by:
iterator in class AbstractReferenceCollection<K>
Returns:
a type-specific iterator on the elements of this collection.

size

public int size()
Specified by:
size in interface Collection<K>
Specified by:
size in class AbstractCollection<K>

clear

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

hashCode

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

equals

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


Copyright © 2011. All Rights Reserved.