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

java.lang.Object
  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:
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.


Method Summary
 boolean add(K k)
           
 void clear()
           
 boolean contains(Object k)
           
 boolean equals(Object o)
           
 int hashCode()
           
 ObjectListIterator<K> iterator()
          Returns a type-specific iterator.
 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, remove, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

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)

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<K>
Overrides:
toArray in class AbstractReferenceCollection<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 ObjectListIterator<K> iterator()
Description copied from interface: ObjectIterable
Returns a type-specific iterator. Note that this specification strengthens the one given in Iterable.iterator().

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.

size

public int size()

clear

public void clear()
Specified by:
clear in interface Collection<K>
Overrides:
clear in class AbstractReferenceCollection<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