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

java.lang.Object
  extended by it.unimi.dsi.fastutil.objects.AbstractObjectCollection<K>
      extended by it.unimi.dsi.fastutil.objects.ObjectCollections.EmptyCollection<K>
All Implemented Interfaces:
ObjectCollection<K>, ObjectIterable<K>, java.lang.Iterable<K>, java.util.Collection<K>
Direct Known Subclasses:
ObjectLists.EmptyList, ObjectSets.EmptySet
Enclosing class:
ObjectCollections

public abstract static class ObjectCollections.EmptyCollection<K>
extends AbstractObjectCollection<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(java.lang.Object k)
           
 boolean equals(java.lang.Object o)
           
 int hashCode()
           
 ObjectListIterator<K> iterator()
          Returns a type-specific iterator on the elements of this collection.
 int size()
           
 java.lang.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.AbstractObjectCollection
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 java.util.Collection<K>
Overrides:
add in class AbstractObjectCollection<K>

contains

public boolean contains(java.lang.Object k)

toArray

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

toArray

public <T> T[] toArray(T[] a)
Description copied from interface: ObjectCollection
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 ObjectCollection<K>
Specified by:
toArray in interface java.util.Collection<K>
Overrides:
toArray in class AbstractObjectCollection<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: ObjectCollection
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 ObjectCollection<K>
Specified by:
iterator in interface ObjectIterable<K>
Specified by:
iterator in interface java.lang.Iterable<K>
Specified by:
iterator in interface java.util.Collection<K>
Specified by:
iterator in class AbstractObjectCollection<K>
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<K>
Overrides:
clear in class AbstractObjectCollection<K>

hashCode

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

equals

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