it.unimi.dsi.fastutil.shorts
Class ShortCollections.EmptyCollection

java.lang.Object
  extended by java.util.AbstractCollection<Short>
      extended by it.unimi.dsi.fastutil.shorts.AbstractShortCollection
          extended by it.unimi.dsi.fastutil.shorts.ShortCollections.EmptyCollection
All Implemented Interfaces:
ShortCollection, ShortIterable, Iterable<Short>, Collection<Short>
Direct Known Subclasses:
ShortBigLists.EmptyBigList, ShortLists.EmptyList, ShortSets.EmptySet
Enclosing class:
ShortCollections

public abstract static class ShortCollections.EmptyCollection
extends AbstractShortCollection

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(short k)
           
 boolean addAll(ShortCollection c)
          Adds all elements of the given type-specific collection to this collection.
 void clear()
           
 boolean contains(short k)
           
 boolean containsAll(ShortCollection c)
          Checks whether this collection contains all elements from the given type-specific collection.
 boolean equals(Object o)
           
 int hashCode()
           
 ShortBidirectionalIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean rem(short 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(ShortCollection c)
          Remove from this collection all elements in the given type-specific collection.
 boolean retainAll(ShortCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 Object[] toArray()
           
 short[] toShortArray()
          Returns a primitive type array containing the items of this collection.
 short[] toShortArray(short[] a)
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.shorts.AbstractShortCollection
add, addAll, contains, containsAll, isEmpty, rem, remove, removeAll, retainAll, shortIterator, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Method Detail

add

public boolean add(short k)
Specified by:
add in interface ShortCollection
Overrides:
add in class AbstractShortCollection
See Also:
Collection.add(Object)

contains

public boolean contains(short k)
Specified by:
contains in interface ShortCollection
Overrides:
contains in class AbstractShortCollection
See Also:
Collection.contains(Object)

toArray

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

toShortArray

public short[] toShortArray(short[] a)
Description copied from interface: ShortCollection
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:
toShortArray in interface ShortCollection
Overrides:
toShortArray in class AbstractShortCollection
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[])

toShortArray

public short[] toShortArray()
Description copied from interface: ShortCollection
Returns a primitive type array containing the items of this collection.

Specified by:
toShortArray in interface ShortCollection
Overrides:
toShortArray in class AbstractShortCollection
Returns:
a primitive type array containing the items of this collection.
See Also:
Collection.toArray()

rem

public boolean rem(short k)
Description copied from interface: ShortCollection
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 ShortCollection
Overrides:
rem in class AbstractShortCollection
See Also:
Collection.remove(Object)

addAll

public boolean addAll(ShortCollection c)
Description copied from class: AbstractShortCollection
Adds all elements of the given type-specific collection to this collection.

Specified by:
addAll in interface ShortCollection
Overrides:
addAll in class AbstractShortCollection
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(ShortCollection c)
Description copied from class: AbstractShortCollection
Remove from this collection all elements in the given type-specific collection.

Specified by:
removeAll in interface ShortCollection
Overrides:
removeAll in class AbstractShortCollection
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(ShortCollection c)
Description copied from class: AbstractShortCollection
Retains in this collection only elements from the given type-specific collection.

Specified by:
retainAll in interface ShortCollection
Overrides:
retainAll in class AbstractShortCollection
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(ShortCollection c)
Description copied from class: AbstractShortCollection
Checks whether this collection contains all elements from the given type-specific collection.

Specified by:
containsAll in interface ShortCollection
Overrides:
containsAll in class AbstractShortCollection
Parameters:
c - a type-specific collection.
Returns:
true if this collection contains all elements of the argument.
See Also:
Collection.containsAll(Collection)

iterator

public ShortBidirectionalIterator iterator()
Description copied from interface: ShortCollection
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 ShortCollection
Specified by:
iterator in interface ShortIterable
Specified by:
iterator in interface Iterable<Short>
Specified by:
iterator in interface Collection<Short>
Specified by:
iterator in class AbstractShortCollection
Returns:
a type-specific iterator on the elements of this collection.

size

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

clear

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

hashCode

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

equals

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