it.unimi.dsi.fastutil.chars
Class CharCollections.EmptyCollection

java.lang.Object
  extended by it.unimi.dsi.fastutil.chars.AbstractCharCollection
      extended by it.unimi.dsi.fastutil.chars.CharCollections.EmptyCollection
All Implemented Interfaces:
CharCollection, CharIterable, Iterable<Character>, Collection<Character>
Direct Known Subclasses:
CharLists.EmptyList, CharSets.EmptySet
Enclosing class:
CharCollections

public abstract static class CharCollections.EmptyCollection
extends AbstractCharCollection

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(char k)
           
 boolean addAll(CharCollection c)
          Adds all elements of the given type-specific collection to this collection.
 void clear()
           
 boolean contains(char k)
           
 boolean containsAll(CharCollection c)
          Checks whether this collection contains all elements from the given type-specific collection.
 boolean equals(Object o)
           
 int hashCode()
           
 CharListIterator iterator()
          Returns a type-specific iterator on the elements of this collection.
 boolean rem(char 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(CharCollection c)
          Remove from this collection all elements in the given type-specific collection.
 boolean retainAll(CharCollection c)
          Retains in this collection only elements from the given type-specific collection.
 int size()
           
 Object[] toArray()
           
 char[] toCharArray()
          Returns a primitive type array containing the items of this collection.
 char[] toCharArray(char[] a)
          Returns a primitive type array containing the items of this collection.
 
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection
add, addAll, charIterator, contains, containsAll, 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(char k)
Specified by:
add in interface CharCollection
Overrides:
add in class AbstractCharCollection
See Also:
Collection.add(Object)

contains

public boolean contains(char k)
See Also:
Collection.contains(Object)

toArray

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

toCharArray

public char[] toCharArray(char[] a)
Description copied from interface: CharCollection
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:
toCharArray in interface CharCollection
Overrides:
toCharArray in class AbstractCharCollection
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[])

toCharArray

public char[] toCharArray()
Description copied from interface: CharCollection
Returns a primitive type array containing the items of this collection.

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

rem

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

addAll

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

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

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

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

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

iterator

public CharListIterator iterator()
Description copied from interface: CharCollection
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 CharCollection
Specified by:
iterator in interface CharIterable
Specified by:
iterator in interface Iterable<Character>
Specified by:
iterator in interface Collection<Character>
Specified by:
iterator in class AbstractCharCollection
Returns:
a type-specific iterator on the elements of this collection.

size

public int size()

clear

public void clear()
Specified by:
clear in interface Collection<Character>
Overrides:
clear in class AbstractCharCollection

hashCode

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

equals

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