Package it.unimi.dsi.fastutil.chars
Class CharSets.Singleton
java.lang.Object
java.util.AbstractCollection<Character>
it.unimi.dsi.fastutil.chars.AbstractCharCollection
it.unimi.dsi.fastutil.chars.AbstractCharSet
it.unimi.dsi.fastutil.chars.CharSets.Singleton
- All Implemented Interfaces:
CharCollection
,CharIterable
,CharSet
,Serializable
,Cloneable
,Iterable<Character>
,Collection<Character>
,Set<Character>
- Direct Known Subclasses:
CharSortedSets.Singleton
- Enclosing class:
- CharSets
public static class CharSets.Singleton extends AbstractCharSet implements Serializable, Cloneable
An immutable class representing a type-specific singleton set.
This class may be useful to implement your own in case you subclass a type-specific set.
- See Also:
- Serialized Form
-
Method Summary
Modifier and Type Method Description boolean
addAll(CharCollection c)
Adds all elements of the given type-specific collection to this collection.boolean
addAll(Collection<? extends Character> c)
Object
clone()
boolean
contains(char k)
Returnstrue
if this collection contains the specified element.CharListIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
remove(char k)
Removes an element from this set.boolean
removeAll(CharCollection c)
Remove from this collection all elements in the given type-specific collection.boolean
removeAll(Collection<?> c)
boolean
retainAll(CharCollection c)
Retains in this collection only elements from the given type-specific collection.boolean
retainAll(Collection<?> c)
int
size()
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharSet
equals, hashCode, rem
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection
add, add, contains, containsAll, remove, toArray, toCharArray, toCharArray, toString
Methods inherited from class java.util.AbstractCollection
clear, containsAll, isEmpty, toArray, toArray
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection
add, containsAll, removeIf, removeIf, toArray, toCharArray, toCharArray
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharIterable
forEach, forEach
Methods inherited from interface java.util.Collection
parallelStream, stream, toArray
Methods inherited from interface java.util.Set
clear, containsAll, isEmpty, spliterator, toArray, toArray
-
Method Details
-
contains
public boolean contains(char k)Description copied from class:AbstractCharCollection
Returnstrue
if this collection contains the specified element.This implementation iterates over the elements in the collection, looking for the specified element.
- Specified by:
contains
in interfaceCharCollection
- Overrides:
contains
in classAbstractCharCollection
- See Also:
Collection.contains(Object)
-
remove
public boolean remove(char k)Description copied from class:AbstractCharSet
Removes an element from this set.Note that the corresponding method of a type-specific collection is
rem()
. This unfortunate situation is caused by the clash with the similarly named index-based method in theList
interface. Delegates to the type-specificrem()
method implemented by type-specific abstractCollection
superclass.- Specified by:
remove
in interfaceCharSet
- Overrides:
remove
in classAbstractCharSet
- See Also:
Collection.remove(Object)
-
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 extendsCollection
.- Specified by:
iterator
in interfaceCharCollection
- Specified by:
iterator
in interfaceCharIterable
- Specified by:
iterator
in interfaceCharSet
- Specified by:
iterator
in interfaceCollection<Character>
- Specified by:
iterator
in interfaceIterable<Character>
- Specified by:
iterator
in interfaceSet<Character>
- Specified by:
iterator
in classAbstractCharSet
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()- Specified by:
size
in interfaceCollection<Character>
- Specified by:
size
in interfaceSet<Character>
- Specified by:
size
in classAbstractCollection<Character>
-
addAll
- Specified by:
addAll
in interfaceCollection<Character>
- Specified by:
addAll
in interfaceSet<Character>
- Overrides:
addAll
in classAbstractCollection<Character>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<Character>
- Specified by:
removeAll
in interfaceSet<Character>
- Overrides:
removeAll
in classAbstractCollection<Character>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<Character>
- Specified by:
retainAll
in interfaceSet<Character>
- Overrides:
retainAll
in classAbstractCollection<Character>
-
addAll
Description copied from interface:CharCollection
Adds all elements of the given type-specific collection to this collection.- Specified by:
addAll
in interfaceCharCollection
- Overrides:
addAll
in classAbstractCharCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
removeAll
Description copied from interface:CharCollection
Remove from this collection all elements in the given type-specific collection.- Specified by:
removeAll
in interfaceCharCollection
- Overrides:
removeAll
in classAbstractCharCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
retainAll
Description copied from interface:CharCollection
Retains in this collection only elements from the given type-specific collection.- Specified by:
retainAll
in interfaceCharCollection
- Overrides:
retainAll
in classAbstractCharCollection
- Parameters:
c
- a type-specific collection.- Returns:
true
if this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
clone
-