public abstract static class CharCollections.EmptyCollection extends AbstractCharCollection
This class may be useful to implement your own in case you subclass a type-specific collection.
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) |
void |
clear() |
boolean |
contains(char k)
Returns
true if this collection contains the specified element. |
boolean |
containsAll(CharCollection c)
Checks whether this collection contains all elements from the given type-specific collection.
|
boolean |
containsAll(java.util.Collection<?> c) |
boolean |
equals(java.lang.Object o) |
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.
|
int |
hashCode() |
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.
|
CharBidirectionalIterator |
iterator()
Returns a type-specific iterator on the elements of this collection.
|
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 collection.
|
java.lang.Object[] |
toArray() |
<T> T[] |
toArray(T[] array) |
char[] |
toCharArray()
Returns a primitive type array containing the items of this collection.
|
char[] |
toCharArray(char[] a)
Deprecated.
|
add, add, contains, rem, remove, toArray, toString
intParallelStream, intStream, parallelStream, removeIf, stream
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 java.lang.Object[] toArray()
toArray
in interface java.util.Collection<java.lang.Character>
toArray
in class java.util.AbstractCollection<java.lang.Character>
public <T> T[] toArray(T[] array)
toArray
in interface java.util.Collection<java.lang.Character>
toArray
in class java.util.AbstractCollection<java.lang.Character>
public CharBidirectionalIterator iterator()
CharCollection
iterator
in interface CharCollection
iterator
in interface CharIterable
iterator
in interface java.lang.Iterable<java.lang.Character>
iterator
in interface java.util.Collection<java.lang.Character>
iterator
in class AbstractCharCollection
Iterable.iterator()
public CharSpliterator spliterator()
CharCollection
See Collection.spliterator()
for more documentation on the requirements
of the returned spliterator.
public int size()
size
in interface java.util.Collection<java.lang.Character>
size
in class java.util.AbstractCollection<java.lang.Character>
public void clear()
clear
in interface java.util.Collection<java.lang.Character>
clear
in class java.util.AbstractCollection<java.lang.Character>
public int hashCode()
hashCode
in interface java.util.Collection<java.lang.Character>
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in interface java.util.Collection<java.lang.Character>
equals
in class java.lang.Object
@Deprecated public void forEach(java.util.function.Consumer<? super java.lang.Character> action)
CharIterable
public boolean containsAll(java.util.Collection<?> c)
AbstractCharCollection
containsAll
in interface java.util.Collection<java.lang.Character>
containsAll
in class AbstractCharCollection
public boolean addAll(java.util.Collection<? extends java.lang.Character> c)
AbstractCharCollection
addAll
in interface java.util.Collection<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 class AbstractCharCollection
public boolean retainAll(java.util.Collection<?> c)
AbstractCharCollection
retainAll
in interface java.util.Collection<java.lang.Character>
retainAll
in class AbstractCharCollection
@Deprecated public boolean removeIf(java.util.function.Predicate<? super java.lang.Character> filter)
CharCollection
public char[] toCharArray()
CharCollection
toCharArray
in interface CharCollection
toCharArray
in class AbstractCharCollection
Collection.toArray()
@Deprecated public char[] toCharArray(char[] a)
AbstractCharCollection
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.
toCharArray
in interface CharCollection
toCharArray
in class AbstractCharCollection
a
- if this array is big enough, it will be used to store this collection.Collection.toArray(Object[])
public void forEach(CharConsumer action)
CharIterable
Iterable
until all elements have been processed or the action throws an
exception.action
- the action to be performed for each element.Iterable.forEach(java.util.function.Consumer)
public boolean containsAll(CharCollection c)
CharCollection
containsAll
in interface CharCollection
containsAll
in class AbstractCharCollection
c
- a type-specific collection.true
if this collection contains all elements of the argument.Collection.containsAll(Collection)
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
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.
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.