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

java.lang.Object
  extended by java.util.AbstractCollection<K>
      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>, Iterable<K>, Collection<K>
Direct Known Subclasses:
ObjectBigLists.EmptyBigList, 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(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.AbstractObjectCollection
addAll, containsAll, isEmpty, objectIterator, 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 AbstractObjectCollection<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 AbstractObjectCollection<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: 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 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 ObjectBidirectionalIterator<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 Iterable<K>
Specified by:
iterator in interface Collection<K>
Specified by:
iterator in class AbstractObjectCollection<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