Class AbstractCharSet
- java.lang.Object
-
- java.util.AbstractCollection<java.lang.Character>
-
- it.unimi.dsi.fastutil.chars.AbstractCharCollection
-
- it.unimi.dsi.fastutil.chars.AbstractCharSet
-
- All Implemented Interfaces:
CharCollection
,CharIterable
,CharSet
,java.lang.Cloneable
,java.lang.Iterable<java.lang.Character>
,java.util.Collection<java.lang.Character>
,java.util.Set<java.lang.Character>
- Direct Known Subclasses:
AbstractCharSortedSet
,CharArraySet
,CharOpenCustomHashSet
,CharOpenHashSet
,CharSets.Singleton
public abstract class AbstractCharSet extends AbstractCharCollection implements java.lang.Cloneable, CharSet
An abstract class providing basic methods for sets implementing a type-specific interface.Note that the type-specific
Set
interface adds a type-specificremove()
method, as it is no longer harmful for subclasses. Thus, concrete subclasses of this class must implementremove()
(therem()
implementation of this class just delegates toremove()
).
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
equals(java.lang.Object o)
int
hashCode()
Returns a hash code for this set.abstract CharIterator
iterator()
Returns a type-specific iterator on the elements of this collection.boolean
rem(char k)
Deprecated.Please useremove()
instead.boolean
remove(char k)
Removes an element from this set.-
Methods inherited from class it.unimi.dsi.fastutil.chars.AbstractCharCollection
add, add, addAll, contains, contains, containsAll, remove, removeAll, retainAll, toArray, toCharArray, toCharArray, toString
-
Methods inherited from class java.util.AbstractCollection
addAll, clear, containsAll, isEmpty, removeAll, retainAll, size, toArray, toArray
-
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharCollection
add, addAll, contains, containsAll, removeAll, removeIf, removeIf, retainAll, toArray, toCharArray, toCharArray
-
Methods inherited from interface it.unimi.dsi.fastutil.chars.CharIterable
forEach, forEach
-
-
-
-
Method Detail
-
iterator
public abstract CharIterator 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 interfacejava.util.Collection<java.lang.Character>
- Specified by:
iterator
in interfacejava.lang.Iterable<java.lang.Character>
- Specified by:
iterator
in interfacejava.util.Set<java.lang.Character>
- Specified by:
iterator
in classAbstractCharCollection
- Returns:
- a type-specific iterator on the elements of this collection.
- See Also:
Iterable.iterator()
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equals
in interfacejava.util.Collection<java.lang.Character>
- Specified by:
equals
in interfacejava.util.Set<java.lang.Character>
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
Returns a hash code for this set. The hash code of a set is computed by summing the hash codes of its elements.- Specified by:
hashCode
in interfacejava.util.Collection<java.lang.Character>
- Specified by:
hashCode
in interfacejava.util.Set<java.lang.Character>
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- a hash code for this set.
-
remove
public boolean remove(char k)
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.
-
rem
@Deprecated public boolean rem(char k)
Deprecated.Please useremove()
instead.Removes a single instance of the specified element from this collection, if it is present (optional operation).Note that this method should be called
remove()
, but the clash with the similarly named index-based method in theList
interface forces us to use a distinguished name. For simplicity, the set interfaces reinstatesremove()
.This implementation iterates over the elements in the collection, looking for the specified element and tries to remove it. Delegates to the type-specific
remove()
method specified in the type-specificSet
interface.- Specified by:
rem
in interfaceCharCollection
- Specified by:
rem
in interfaceCharSet
- Overrides:
rem
in classAbstractCharCollection
- See Also:
Collection.remove(Object)
-
-