public static class CharSets.Singleton extends AbstractCharSet implements java.io.Serializable, java.lang.Cloneable
This class may be useful to implement your own in case you subclass a type-specific set.
Modifier and Type | Method and Description |
---|---|
boolean |
addAll(CharCollection c)
Adds all elements of the given type-specific collection to this collection.
|
boolean |
addAll(java.util.Collection<? extends java.lang.Character> c) |
java.lang.Object |
clone() |
boolean |
contains(char k)
Returns
true if this collection contains the specified element. |
void |
forEach(CharConsumer action)
Performs the given action for each element of this type-specific
Iterable
until all elements have been processed or the action throws an
exception. |
void |
forEach(java.util.function.Consumer<? super java.lang.Character> action)
Deprecated.
|
IntIterator |
intIterator()
Returns a widened primitive iterator on the elements of this collection.
|
IntSpliterator |
intSpliterator()
Returns widened primitive spliterator on the elements of this collection.
|
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(java.util.Collection<?> c) |
boolean |
removeIf(CharPredicate filter)
Remove from this collection all elements which satisfy the given predicate.
|
boolean |
removeIf(java.util.function.Predicate<? super java.lang.Character> filter)
Deprecated.
|
boolean |
retainAll(CharCollection c)
Retains in this collection only elements from the given type-specific collection.
|
boolean |
retainAll(java.util.Collection<?> c) |
int |
size() |
CharSpliterator |
spliterator()
Returns a type-specific spliterator on the elements of this set.
|
java.lang.Object[] |
toArray()
Deprecated.
|
char[] |
toCharArray()
Returns a primitive type array containing the items of this collection.
|
equals, hashCode, rem
add, add, contains, containsAll, containsAll, remove, toArray, toCharArray, toString
add, contains, of, of, of, of, of, remove
add, containsAll, intParallelStream, intStream, parallelStream, removeIf, stream, toArray, toCharArray
forEach
public boolean contains(char k)
AbstractCharCollection
true
if this collection contains the specified element.contains
in interface CharCollection
contains
in class AbstractCharCollection
Collection.contains(Object)
public boolean remove(char k)
AbstractCharSet
rem()
method
implemented by type-specific abstract Collection
superclass.remove
in interface CharSet
remove
in class AbstractCharSet
Collection.remove(Object)
public CharListIterator iterator()
CharCollection
iterator
in interface CharCollection
iterator
in interface CharIterable
iterator
in interface CharSet
iterator
in interface java.lang.Iterable<java.lang.Character>
iterator
in interface java.util.Collection<java.lang.Character>
iterator
in interface java.util.Set<java.lang.Character>
iterator
in class AbstractCharSet
Iterable.iterator()
public CharSpliterator spliterator()
CharSet
Set spliterators must report at least Spliterator.DISTINCT
.
See Set.spliterator()
for more documentation on the requirements
of the returned spliterator.
spliterator
in interface CharCollection
spliterator
in interface CharIterable
spliterator
in interface CharSet
spliterator
in interface java.lang.Iterable<java.lang.Character>
spliterator
in interface java.util.Collection<java.lang.Character>
spliterator
in interface java.util.Set<java.lang.Character>
public int size()
size
in interface java.util.Collection<java.lang.Character>
size
in interface java.util.Set<java.lang.Character>
size
in class java.util.AbstractCollection<java.lang.Character>
public char[] toCharArray()
CharCollection
toCharArray
in interface CharCollection
toCharArray
in class AbstractCharCollection
Collection.toArray()
@Deprecated public void forEach(java.util.function.Consumer<? super java.lang.Character> action)
CharIterable
forEach
in interface CharIterable
forEach
in interface java.lang.Iterable<java.lang.Character>
public boolean addAll(java.util.Collection<? extends java.lang.Character> c)
AbstractCharCollection
addAll
in interface java.util.Collection<java.lang.Character>
addAll
in interface java.util.Set<java.lang.Character>
addAll
in class AbstractCharCollection
public boolean removeAll(java.util.Collection<?> c)
AbstractCharCollection
removeAll
in interface java.util.Collection<java.lang.Character>
removeAll
in interface java.util.Set<java.lang.Character>
removeAll
in class AbstractCharCollection
public boolean retainAll(java.util.Collection<?> c)
AbstractCharCollection
retainAll
in interface java.util.Collection<java.lang.Character>
retainAll
in interface java.util.Set<java.lang.Character>
retainAll
in class AbstractCharCollection
@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Character> filter)
CharCollection
removeIf
in interface CharCollection
removeIf
in interface java.util.Collection<java.lang.Character>
public void forEach(CharConsumer action)
CharIterable
Iterable
until all elements have been processed or the action throws an
exception.forEach
in interface CharIterable
action
- the action to be performed for each element.Iterable.forEach(java.util.function.Consumer)
public boolean addAll(CharCollection c)
CharCollection
addAll
in interface CharCollection
addAll
in class AbstractCharCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.addAll(Collection)
public boolean removeAll(CharCollection c)
CharCollection
removeAll
in interface CharCollection
removeAll
in class AbstractCharCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.removeAll(Collection)
public boolean retainAll(CharCollection c)
CharCollection
retainAll
in interface CharCollection
retainAll
in class AbstractCharCollection
c
- a type-specific collection.true
if this collection changed as a result of the call.Collection.retainAll(Collection)
public boolean removeIf(CharPredicate filter)
CharCollection
removeIf
in interface CharCollection
filter
- a predicate which returns true
for elements to be
removed.true
if any elements were removed.Collection.removeIf(java.util.function.Predicate)
public IntIterator intIterator()
CharCollection
This method is provided for the purpose of APIs that expect only the JDK's
primitive iterators, of which there are only int
, long
, and double
.
WARNING: This is not the same as converting the source to a sequence
of code points. This returned instance literally performs (int)(charValue)
casts.
Surrogate pairs will be left as separate elements instead of combined into a single element
with the code point it represents. See Character
for more discussion on code points,
char values, and surrogate pairs.
intIterator
in interface CharCollection
intIterator
in interface CharIterable
public IntSpliterator intSpliterator()
CharCollection
This method is provided for the purpose of APIs that expect only the JDK's
primitive spliterators, of which there are only int
, long
, and double
.
WARNING: This is not the same as converting the source to a sequence
of code points. This returned instance literally performs (int)(charValue)
casts.
Surrogate pairs will be left as separate elements instead of combined into a single element
with the code point it represents. See Character
for more discussion on code points,
char values, and surrogate pairs.
intSpliterator
in interface CharCollection
intSpliterator
in interface CharIterable
@Deprecated public java.lang.Object[] toArray()
toArray
in interface java.util.Collection<java.lang.Character>
toArray
in interface java.util.Set<java.lang.Character>
toArray
in class java.util.AbstractCollection<java.lang.Character>
public java.lang.Object clone()
clone
in class java.lang.Object