it.unimi.dsi.fastutil.floats
Class FloatCollections.EmptyCollection

java.lang.Object
  extended by java.util.AbstractCollection<Float>
      extended by it.unimi.dsi.fastutil.floats.AbstractFloatCollection
          extended by it.unimi.dsi.fastutil.floats.FloatCollections.EmptyCollection
All Implemented Interfaces:
FloatCollection, FloatIterable, Iterable<Float>, Collection<Float>
Direct Known Subclasses:
FloatBigLists.EmptyBigList, FloatLists.EmptyList, FloatSets.EmptySet
Enclosing class:
FloatCollections

public abstract static class FloatCollections.EmptyCollection
extends AbstractFloatCollection

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 FloatCollections.EmptyCollection()
           
 
Method Summary
 boolean add(float k)
           
 boolean addAll(FloatCollection c)
          Adds all elements of the given type-specific collection to this collection.
 void clear()
           
 boolean contains(float k)
           
 boolean containsAll(FloatCollection c)
          Checks whether this collection contains all elements from the given type-specific collection.
 boolean equals(Object o)
           
 int hashCode()
           
 FloatBidirectionalIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean rem(float 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(FloatCollection c)
          Remove from this collection all elements in the given type-specific collection.
 boolean retainAll(FloatCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 Object[] toArray()
           
 float[] toFloatArray()
          Returns a primitive type array containing the items of this collection.
 float[] toFloatArray(float[] a)
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.floats.AbstractFloatCollection
add, addAll, contains, containsAll, floatIterator, isEmpty, rem, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FloatCollections.EmptyCollection

protected FloatCollections.EmptyCollection()
Method Detail

add

public boolean add(float k)
Specified by:
add in interface FloatCollection
Overrides:
add in class AbstractFloatCollection
See Also:
Collection.add(Object)

contains

public boolean contains(float k)
Specified by:
contains in interface FloatCollection
Overrides:
contains in class AbstractFloatCollection
See Also:
Collection.contains(Object)

toArray

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

toFloatArray

public float[] toFloatArray(float[] a)
Description copied from interface: FloatCollection
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:
toFloatArray in interface FloatCollection
Overrides:
toFloatArray in class AbstractFloatCollection
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[])

toFloatArray

public float[] toFloatArray()
Description copied from interface: FloatCollection
Returns a primitive type array containing the items of this collection.

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

rem

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

addAll

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

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

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

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

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

iterator

public FloatBidirectionalIterator iterator()
Description copied from interface: FloatCollection
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 FloatCollection
Specified by:
iterator in interface FloatIterable
Specified by:
iterator in interface Iterable<Float>
Specified by:
iterator in interface Collection<Float>
Specified by:
iterator in class AbstractFloatCollection
Returns:
a type-specific iterator on the elements of this collection.

size

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

clear

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

hashCode

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

equals

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


Copyright © 2011. All Rights Reserved.