it.unimi.dsi.fastutil.ints
Class IntCollections.EmptyCollection

java.lang.Object
  extended by java.util.AbstractCollection<Integer>
      extended by it.unimi.dsi.fastutil.ints.AbstractIntCollection
          extended by it.unimi.dsi.fastutil.ints.IntCollections.EmptyCollection
All Implemented Interfaces:
IntCollection, IntIterable, Iterable<Integer>, Collection<Integer>
Direct Known Subclasses:
IntBigLists.EmptyBigList, IntLists.EmptyList, IntSets.EmptySet
Enclosing class:
IntCollections

public abstract static class IntCollections.EmptyCollection
extends AbstractIntCollection

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

Method Detail

add

public boolean add(int k)
Specified by:
add in interface IntCollection
Overrides:
add in class AbstractIntCollection
See Also:
Collection.add(Object)

contains

public boolean contains(int k)
Specified by:
contains in interface IntCollection
Overrides:
contains in class AbstractIntCollection
See Also:
Collection.contains(Object)

toArray

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

toIntArray

public int[] toIntArray(int[] a)
Description copied from interface: IntCollection
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:
toIntArray in interface IntCollection
Overrides:
toIntArray in class AbstractIntCollection
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[])

toIntArray

public int[] toIntArray()
Description copied from interface: IntCollection
Returns a primitive type array containing the items of this collection.

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

rem

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

addAll

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

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

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

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

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

iterator

public IntBidirectionalIterator iterator()
Description copied from interface: IntCollection
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 IntCollection
Specified by:
iterator in interface IntIterable
Specified by:
iterator in interface Iterable<Integer>
Specified by:
iterator in interface Collection<Integer>
Specified by:
iterator in class AbstractIntCollection
Returns:
a type-specific iterator on the elements of this collection.

size

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

clear

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

hashCode

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

equals

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