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 booleanaddAll(CharCollection c)Adds all elements of the given type-specific collection to this collection.booleanaddAll(Collection<? extends Character> c)Objectclone()booleancontains(char k)Returnstrueif this collection contains the specified element.CharListIteratoriterator()Returns a type-specific iterator on the elements of this collection.booleanremove(char k)Removes an element from this set.booleanremoveAll(CharCollection c)Remove from this collection all elements in the given type-specific collection.booleanremoveAll(Collection<?> c)booleanretainAll(CharCollection c)Retains in this collection only elements from the given type-specific collection.booleanretainAll(Collection<?> c)intsize()Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection
add, add, contains, containsAll, remove, toArray, toCharArray, toCharArray, toStringMethods inherited from class java.util.AbstractCollection
clear, containsAll, isEmpty, toArray, toArrayMethods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection
add, containsAll, removeIf, removeIf, toArray, toCharArray, toCharArrayMethods inherited from interface java.util.Set
clear, containsAll, isEmpty, spliterator, toArray, toArray
-
Method Details
-
contains
public boolean contains(char k)Description copied from class:AbstractCharCollectionReturnstrueif this collection contains the specified element.This implementation iterates over the elements in the collection, looking for the specified element.
- Specified by:
containsin interfaceCharCollection- Overrides:
containsin classAbstractCharCollection- See Also:
Collection.contains(Object)
-
remove
public boolean remove(char k)Description copied from class:AbstractCharSetRemoves 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 theListinterface. Delegates to the type-specificrem()method implemented by type-specific abstractCollectionsuperclass.- Specified by:
removein interfaceCharSet- Overrides:
removein classAbstractCharSet- See Also:
Collection.remove(Object)
-
iterator
Description copied from interface:CharCollectionReturns 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:
iteratorin interfaceCharCollection- Specified by:
iteratorin interfaceCharIterable- Specified by:
iteratorin interfaceCharSet- Specified by:
iteratorin interfaceCollection<Character>- Specified by:
iteratorin interfaceIterable<Character>- Specified by:
iteratorin interfaceSet<Character>- Specified by:
iteratorin classAbstractCharSet- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
size
public int size()- Specified by:
sizein interfaceCollection<Character>- Specified by:
sizein interfaceSet<Character>- Specified by:
sizein classAbstractCollection<Character>
-
addAll
- Specified by:
addAllin interfaceCollection<Character>- Specified by:
addAllin interfaceSet<Character>- Overrides:
addAllin classAbstractCollection<Character>
-
removeAll
- Specified by:
removeAllin interfaceCollection<Character>- Specified by:
removeAllin interfaceSet<Character>- Overrides:
removeAllin classAbstractCollection<Character>
-
retainAll
- Specified by:
retainAllin interfaceCollection<Character>- Specified by:
retainAllin interfaceSet<Character>- Overrides:
retainAllin classAbstractCollection<Character>
-
addAll
Description copied from interface:CharCollectionAdds all elements of the given type-specific collection to this collection.- Specified by:
addAllin interfaceCharCollection- Overrides:
addAllin classAbstractCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.addAll(Collection)
-
removeAll
Description copied from interface:CharCollectionRemove from this collection all elements in the given type-specific collection.- Specified by:
removeAllin interfaceCharCollection- Overrides:
removeAllin classAbstractCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.removeAll(Collection)
-
retainAll
Description copied from interface:CharCollectionRetains in this collection only elements from the given type-specific collection.- Specified by:
retainAllin interfaceCharCollection- Overrides:
retainAllin classAbstractCharCollection- Parameters:
c- a type-specific collection.- Returns:
trueif this collection changed as a result of the call.- See Also:
Collection.retainAll(Collection)
-
clone
-