@FunctionalInterface public interface CharSeq extends CharCollection
Iterable
sequence of char
values with Stream
-like operations for refining,
transforming and collating the list of characters.CharCollection.Base
Modifier and Type | Method and Description |
---|---|
static CharSeq |
all()
A
CharSeq of all the Character values starting at Character.MIN_VALUE and ending at
Character.MAX_VALUE . |
default boolean |
all(CharPredicate predicate) |
default boolean |
any(CharPredicate predicate) |
default CharSeq |
append(char... characters)
Append the given
chars to the end of this CharSeq . |
default CharSeq |
append(CharIterable that)
|
default CharSeq |
append(CharIterator iterator)
|
default CharSeq |
append(java.util.stream.IntStream stream)
Append the
char values of the ints in the given IntStream to the end of this
CharSeq . |
default CharSeq |
append(java.lang.Iterable<java.lang.Character> iterable)
Append the
Character s in the given Iterable to the end of this CharSeq . |
default CharSeq |
append(java.util.Iterator<java.lang.Character> iterator)
Append the
Character s in the given Iterator to the end of this CharSeq . |
default CharSeq |
append(java.util.PrimitiveIterator.OfInt iterator)
Append the
chars in the given PrimitiveIterator.OfInt to the end of this CharSeq . |
default CharSeq |
append(java.util.stream.Stream<java.lang.Character> stream)
Append the
Character s in the given Stream to the end of this CharSeq . |
default CharList |
asList() |
default java.lang.String |
asString() |
default OptionalChar |
at(int index) |
default OptionalChar |
at(int index,
CharPredicate predicate) |
default Sequence<CharSeq> |
batch(CharBiPredicate predicate)
Batch the elements of this
Sequence into a sequence of CharSeq s of distinct elements, where the
given predicate determines where to split the lists of partitioned elements. |
default Sequence<CharSeq> |
batch(int size)
Batch the elements of this
Sequence into a sequence of CharSeq s of distinct elements, each with
the given batch size. |
default Sequence<java.lang.Character> |
box()
Map the
chars in this CharSeq to their boxed Character counterparts. |
static CharSeq |
cache(CharIterable iterable)
Create a
CharSeq from a cached copy of an CharIterable . |
static CharSeq |
cache(CharIterator iterator)
Create a
CharSeq from a cached copy of a CharIterator . |
static CharSeq |
cache(java.util.stream.IntStream stream)
Create a
CharSeq from a cached copy of a IntStream of char values. |
static CharSeq |
cache(java.lang.Iterable<java.lang.Character> iterable)
Create a
CharSeq from a cached copy of an Iterable of Character values. |
static CharSeq |
cache(java.util.Iterator<java.lang.Character> iterator)
Create a
CharSeq from a cached copy of an Iterator of Character s. |
static CharSeq |
cache(java.util.PrimitiveIterator.OfInt iterator)
Create a
CharSeq from a cached copy of an PrimitiveIterator.OfInt of char values. |
static CharSeq |
cache(java.util.stream.Stream<java.lang.Character> stream)
Create a
CharSeq from a cached copy of a Stream of Character s. |
default <C> C |
collect(java.util.function.Supplier<? extends C> constructor,
ObjCharConsumer<? super C> adder)
Collect this
CharSeq into an arbitrary container using the given constructor and adder. |
default <C> C |
collectInto(C result,
ObjCharConsumer<? super C> adder)
Collect this
CharSeq into the given container using the given adder. |
default <U extends CharCollection> |
collectInto(U collection)
Collect this
CharSeq into the given CharCollection . |
default CharSeq |
distinct() |
static CharSeq |
empty()
Create an empty
CharSeq with no characters. |
default CharSeq |
endingAt(char terminal)
Terminate this
CharSeq sequence at the given element, including it as the last element in this CharSeq sequence. |
default CharSeq |
endingAt(CharPredicate terminal)
Terminate this
CharSeq sequence at the element that satisfies the given predicate, including the
element as the last element in this CharSeq sequence. |
default CharSeq |
excluding(char... elements) |
default CharSeq |
filter(CharPredicate predicate)
Filter the elements in this
CharSeq , keeping only the elements that match the given
CharPredicate . |
default CharSeq |
filterBack(char firstPrevious,
CharBiPredicate predicate)
Filter this
CharSeq to another sequence of chars while peeking at the previous value in the
sequence. |
default CharSeq |
filterForward(char lastNext,
CharBiPredicate predicate)
Filter this
CharSeq to another sequence of chars while peeking at the next char in the sequence. |
default CharSeq |
filterIndexed(CharIntPredicate predicate)
Filter the elements in this
CharSeq , keeping only the elements that match the given
CharIntPredicate , which is passed each double together with its index in the sequence. |
default OptionalChar |
first() |
default OptionalChar |
first(CharPredicate predicate) |
default void |
forEachCharIndexed(CharIntConsumer action)
Perform the given action for each
char in this CharSeq , with the index of each element passed
as the second parameter in the action. |
static CharSeq |
from(CharIterable iterable)
Create a
CharSeq from a CharIterable . |
static CharSeq |
from(java.lang.CharSequence csq)
Create a
CharSeq from a CharSequence . |
static CharSeq |
from(java.lang.Iterable<java.lang.Character> iterable)
Create a
CharSeq from an Iterable of Character values. |
static CharSeq |
generate(CharSupplier supplier) |
default CharSeq |
including(char... elements) |
default CharSeq |
interleave(CharIterable that)
Interleave the elements in this
CharSeq with those of the given CharIterable , stopping when
either sequence finishes. |
default java.util.Spliterator.OfInt |
intSpliterator() |
default boolean |
isEmpty() |
default java.lang.String |
join()
Join this
CharSeq into a string. |
default java.lang.String |
join(java.lang.String delimiter)
Join this
CharSeq into a string separated by the given delimiter. |
default java.lang.String |
join(java.lang.String prefix,
java.lang.String delimiter,
java.lang.String suffix)
Join this
CharSeq into a string separated by the given delimiter, with the given prefix and suffix. |
default OptionalChar |
last() |
default OptionalChar |
last(CharPredicate predicate) |
default CharSeq |
limit(int limit)
Limit the maximum number of
chars returned by this CharSeq . |
default CharSeq |
map(CharUnaryOperator mapper)
Map the
chars in this CharSeq to another set of chars specified by the given
mapper function. |
default CharSeq |
mapBack(char firstPrevious,
CharBinaryOperator mapper)
Map this
CharSeq to another sequence of characters while peeking at the previous character in the
sequence. |
default CharSeq |
mapForward(char lastNext,
CharBinaryOperator mapper)
Map this
CharSeq to another sequence of characters while peeking at the next character in the sequence. |
default CharSeq |
mapIndexed(CharIntToCharFunction mapper)
Map the
chars in this CharSeq to another set of chars specified by the given
mapper function, while providing the current index to the mapper. |
default OptionalChar |
max() |
default OptionalChar |
min() |
static CharSeq |
multiGenerate(java.util.function.Supplier<? extends CharSupplier> supplierSupplier) |
default boolean |
none(CharPredicate predicate) |
static CharSeq |
of(char... cs)
Create a
CharSeq with the given characters. |
static CharSeq |
once(CharIterator iterator)
Create a once-only
CharSeq from a CharIterator of character values. |
static CharSeq |
once(java.util.stream.IntStream stream)
Create a once-only
CharSeq from an IntStream of char values. |
static CharSeq |
once(java.util.Iterator<java.lang.Character> iterator)
Create a once-only
CharSeq from an Iterator of Character values. |
static CharSeq |
once(java.util.PrimitiveIterator.OfInt iterator)
Create a once-only
CharSeq from a PrimitiveIterator.OfInt of character values. |
static CharSeq |
once(java.util.stream.Stream<java.lang.Character> stream)
Create a once-only
CharSeq from a Stream of items. |
default CharSeq |
peek(CharConsumer action)
Allow the given
CharConsumer to see each element in this CharSeq as it is traversed. |
default CharSeq |
peekIndexed(CharIntConsumer action)
Allow the given
CharIntConsumer to see each element together with its index in this CharSeq as
it is traversed. |
default CharSeq |
prefix(char... cs)
Prefix the characters in this
CharSeq with the given characters. |
static CharSeq |
random(char lower,
char upper) |
static CharSeq |
random(java.lang.String... ranges)
Create a
CharSeq of random characters as indicated by the given char ranges. |
static CharSeq |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
char lower,
char upper) |
static CharSeq |
random(java.util.function.Supplier<? extends java.util.Random> randomSupplier,
java.lang.String... ranges)
Create a
CharSeq of random characters as indicated by the given char ranges. |
static CharSeq |
range(char start,
char end)
A
CharSeq of all the Character values between the given start and end positions, inclusive. |
static CharSeq |
read(java.io.Reader reader)
Create a
CharSeq from a Reader which iterates over the characters provided in the reader. |
static CharSeq |
recurse(char seed,
CharUnaryOperator op)
Returns a
CharSeq sequence produced by recursively applying the given operation to the given seed, which
forms the first element of the sequence, the second being f(seed), the third f(f(seed)) and so on. |
default OptionalChar |
reduce(CharBinaryOperator operator)
Reduce this
CharSeq into a single char by iteratively applying the given binary operator to
the current result and each char in the sequence. |
default char |
reduce(char identity,
CharBinaryOperator operator)
Reduce this
CharSeq into a single char by iteratively applying the given binary operator to
the current result and each char in the sequence, starting with the given identity as the initial
result. |
default CharSeq |
repeat()
Repeat this sequence of characters forever, looping back to the beginning when the iterator runs out of chars.
|
default CharSeq |
repeat(int times)
Repeat this sequence of characters x times, looping back to the beginning when the iterator runs out of chars.
|
default CharSeq |
reverse() |
default int |
size() |
default CharSeq |
skip(int skip)
Skip a set number of
chars in this CharSeq . |
default CharSeq |
skipTail(int skip)
Skip a set number of
chars at the end of this CharSequence . |
default CharSeq |
sorted() |
default Sequence<CharSeq> |
split(char element)
Split the
chars of this CharSeq into a sequence of CharSeq s of distinct elements, around
the given char . |
default Sequence<CharSeq> |
split(CharPredicate predicate)
Split the
chars of this CharSeq charo a sequence of CharSeq s of distinct elements, where
the given predicate determines which chars to split the partitioned elements around. |
default java.util.Spliterator<java.lang.Character> |
spliterator() |
default CharSeq |
startingAfter(char element)
Begin this
CharSeq just after the given element is encountered, not including the element in the
CharSeq . |
default CharSeq |
startingAfter(CharPredicate predicate)
Begin this
CharSeq just after the given predicate is satisfied, not including the element that
satisfies the predicate in the CharSeq . |
static CharSeq |
startingAt(char start)
A
CharSeq of all the Character values starting at the given value and ending at Character.MAX_VALUE . |
default CharSeq |
startingFrom(char element)
Begin this
CharSeq when the given element is encountered, including the element as the first element
in the CharSeq . |
default CharSeq |
startingFrom(CharPredicate predicate)
Begin this
CharSeq when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the CharSeq . |
default CharSeq |
step(int step)
Skip x number of steps in between each invocation of the iterator of this
CharSeq . |
default CharSeq |
suffix(char... cs)
Suffix the characters in this
CharSeq with the given characters. |
default <U extends CharCollection> |
toCollection(java.util.function.Supplier<? extends U> constructor)
Collect this
CharSeq into an CharCollection of the type determined by the given constructor. |
default IntSequence |
toInts()
Convert this sequence of characters to a sequence of ints corresponding to the integer value of each character.
|
default IntSequence |
toInts(CharToIntFunction mapper)
Convert this sequence of characters to a sequence of ints corresponding to the integer value of each character.
|
default CharList |
toList()
Collect the elements in this
CharSeq into an CharList . |
default CharList |
toList(java.util.function.Supplier<? extends CharList> constructor)
Collect the elements in this
CharSeq into an CharList of the type determined by the given
constructor. |
default <T> Sequence<T> |
toSequence(CharFunction<T> mapper)
|
default CharSet |
toSet()
Collect the elements in this
CharSeq into an CharSet . |
default <S extends CharSet> |
toSet(java.util.function.Supplier<? extends S> constructor)
Collect the elements in this
CharSeq into an CharSet of the type determined by the given
constructor. |
default CharSortedSet |
toSortedSet()
Collect the elements in this
CharSeq into an CharSortedSet . |
default CharSeq |
until(char terminal)
Terminate this
CharSeq sequence before the given element, with the previous element as the last
element in this CharSeq sequence. |
default CharSeq |
until(CharPredicate terminal)
Terminate this
CharSeq sequence before the element that satisfies the given predicate, with the previous
element as the last element in this CharSeq sequence. |
default Sequence<CharSeq> |
window(int window)
Window the elements of this
CharSeq into a sequence of CharSeq s of elements, each with the size
of the given window. |
default Sequence<CharSeq> |
window(int window,
int step)
Window the elements of this
Sequence into a sequence of CharSeq s of elements, each with the size
of the given window, stepping step elements between each window. |
add, addAll, addAllChars, addAllChars, addChar, clear, contains, containsAll, remove, removeAll, removeIf, retainAll, toArray, toArray, toCharArray
equals, hashCode, iterator, parallelStream, stream
asReader, containsAllChars, containsAllChars, containsAnyChars, containsAnyChars, containsChar, forEach, forEachChar, from, intIterator, intStream, iterator, parallelIntStream, removeAllChars, removeAllChars, removeChar, removeCharsIf, retainAllChars, retainAllChars, sequence
static CharSeq empty()
CharSeq
with no characters.static CharSeq of(char... cs)
CharSeq
with the given characters.of
in interface CharIterable
static CharSeq from(java.lang.CharSequence csq)
CharSeq
from a CharSequence
.static CharSeq from(CharIterable iterable)
CharSeq
from a CharIterable
.cache(CharIterable)
static CharSeq from(java.lang.Iterable<java.lang.Character> iterable)
CharSeq
from an Iterable
of Character
values.from
in interface CharIterable
cache(Iterable)
static CharSeq once(CharIterator iterator)
CharSeq
from a CharIterator
of character values. Note that CharSeq
s created from CharIterator
s cannot be passed over more than once. Further attempts
will register the CharSeq
as empty.once
in interface CharIterable
cache(CharIterator)
static CharSeq once(java.util.PrimitiveIterator.OfInt iterator)
CharSeq
from a PrimitiveIterator.OfInt
of character values. Note that CharSeq
s created from PrimitiveIterator.OfInt
s cannot be passed over more than once. Further attempts
will register the CharSeq
as empty.cache(PrimitiveIterator.OfInt)
static CharSeq once(java.util.Iterator<java.lang.Character> iterator)
CharSeq
from an Iterator
of Character
values. Note that CharSeq
s created from Iterator
s cannot be passed over more than once. Further attempts will
register the CharSeq
as empty.cache(Iterator)
static CharSeq once(java.util.stream.Stream<java.lang.Character> stream)
CharSeq
from a Stream
of items. Note that CharSeq
created from Stream
s cannot be passed over more than once. Further attempts will register the CharSeq
as empty.java.lang.IllegalStateException
- if the Stream
is exhausted.cache(Stream)
static CharSeq once(java.util.stream.IntStream stream)
CharSeq
from an IntStream
of char values. Note that CharSeq
created
from IntStream
s cannot be passed over more than once. Further attempts will register the CharSeq
as empty.java.lang.IllegalStateException
- if the IntStream
is exhausted.cache(IntStream)
static CharSeq read(java.io.Reader reader)
CharSeq
from a Reader
which iterates over the characters provided in the reader.
The Reader
must support Reader.reset()
or the CharSeq
will only be available to iterate
over once. The Reader
will be reset in between iterations, if possible. If an IOException
occurs during iteration, an IterationException
will be thrown. The Reader
will not be closed
by the CharSeq
when iteration finishes, it must be closed externally when iteration is finished.read
in interface CharIterable
static CharSeq cache(CharIterator iterator)
CharSeq
from a cached copy of a CharIterator
.cache(Iterator)
,
cache(PrimitiveIterator.OfInt)
,
cache(IntStream)
,
cache(Stream)
,
cache(CharIterable)
,
cache(Iterable)
,
once(CharIterator)
static CharSeq cache(java.util.PrimitiveIterator.OfInt iterator)
CharSeq
from a cached copy of an PrimitiveIterator.OfInt
of char values.cache(CharIterator)
,
cache(Iterator)
,
cache(IntStream)
,
cache(Stream)
,
cache(CharIterable)
,
cache(Iterable)
,
once(Iterator)
static CharSeq cache(java.util.Iterator<java.lang.Character> iterator)
CharSeq
from a cached copy of an Iterator
of Character
s.cache(CharIterator)
,
cache(PrimitiveIterator.OfInt)
,
cache(IntStream)
,
cache(Stream)
,
cache(CharIterable)
,
cache(Iterable)
,
once(Iterator)
static CharSeq cache(java.util.stream.IntStream stream)
CharSeq
from a cached copy of a IntStream
of char values.cache(Stream)
,
cache(CharIterable)
,
cache(Iterable)
,
cache(CharIterator)
,
cache(PrimitiveIterator.OfInt)
,
cache(Iterator)
,
once(IntStream)
static CharSeq cache(java.util.stream.Stream<java.lang.Character> stream)
CharSeq
from a cached copy of a Stream
of Character
s.cache(IntStream)
,
cache(CharIterable)
,
cache(Iterable)
,
cache(CharIterator)
,
cache(PrimitiveIterator.OfInt)
,
cache(Iterator)
,
once(Stream)
static CharSeq cache(CharIterable iterable)
CharSeq
from a cached copy of an CharIterable
.cache(Iterable)
,
cache(IntStream)
,
cache(Stream)
,
cache(CharIterator)
,
cache(PrimitiveIterator.OfInt)
,
cache(Iterator)
,
from(CharIterable)
static CharSeq cache(java.lang.Iterable<java.lang.Character> iterable)
CharSeq
from a cached copy of an Iterable
of Character
values.cache(CharIterable)
,
cache(IntStream)
,
cache(Stream)
,
cache(CharIterator)
,
cache(PrimitiveIterator.OfInt)
,
cache(Iterator)
,
from(Iterable)
static CharSeq all()
CharSeq
of all the Character
values starting at Character.MIN_VALUE
and ending at
Character.MAX_VALUE
.startingFrom(char)
,
range(char, char)
,
until(char)
,
endingAt(char)
static CharSeq startingAt(char start)
CharSeq
of all the Character
values starting at the given value and ending at Character.MAX_VALUE
.all()
,
range(char, char)
,
until(char)
,
endingAt(char)
static CharSeq range(char start, char end)
CharSeq
of all the Character
values between the given start and end positions, inclusive.all()
,
startingFrom(char)
,
until(char)
,
endingAt(char)
static CharSeq recurse(char seed, CharUnaryOperator op)
CharSeq
sequence produced by recursively applying the given operation to the given seed, which
forms the first element of the sequence, the second being f(seed), the third f(f(seed)) and so on. The returned
CharSeq
sequence never terminates naturally.CharSeq
sequence produced by recursively applying the given operation to the given seedgenerate(CharSupplier)
,
endingAt(char)
,
until(char)
static CharSeq generate(CharSupplier supplier)
CharSeq
that is generated from the given supplier and thus never terminates. Further
iterations of the sequence will reuse the same supplier and may thus mix output from the same supplier if
iterators are interleaved.recurse(char, CharUnaryOperator)
,
endingAt(char)
,
until(char)
static CharSeq multiGenerate(java.util.function.Supplier<? extends CharSupplier> supplierSupplier)
CharSeq
where each Collection.iterator()
is generated by polling for a supplier and then using
it to generate the sequence of characters. The sequence never terminates.recurse(char, CharUnaryOperator)
,
endingAt(char)
,
until(char)
static CharSeq random(char lower, char upper)
CharSeq
of random characters between the lower and upper bounds, inclusive, that never
terminates. Each run of this CharSeq's
Collection.iterator()
will produce a new random sequence of
characters. This method is equivalent to random(Random::new, lower, upper
.random(Supplier, char, char)
,
multiGenerate(Supplier)
static CharSeq random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, char lower, char upper)
CharSeq
of random characters between the lower and upper bounds, inclusive, that never
terminates. The given supplier is used to produce the instance of Random
that is used, one for each
new Collection.iterator()
.random(char, char)
,
multiGenerate(Supplier)
static CharSeq random(java.lang.String... ranges)
CharSeq
of random characters as indicated by the given char ranges. Each char range is in the
format "A-F"
where [@code A} is the lower bound and F
is the upped bound, inclusive. Each run
of this CharSeq's
Collection.iterator()
will produce a new random sequence of characters. This method is
equivalent to random(Random::new, ranges
.random(Supplier, String...)
,
multiGenerate(Supplier)
static CharSeq random(java.util.function.Supplier<? extends java.util.Random> randomSupplier, java.lang.String... ranges)
CharSeq
of random characters as indicated by the given char ranges. Each char range is in the
format "A-F"
where [@code A} is the lower bound and F
is the upped bound, inclusive. The given
supplier is used to produce the instance of Random
that is used, one for each new Collection.iterator()
.random(String...)
,
multiGenerate(Supplier)
default CharSeq until(char terminal)
CharSeq
sequence before the given element, with the previous element as the last
element in this CharSeq
sequence.default CharSeq endingAt(char terminal)
CharSeq
sequence at the given element, including it as the last element in this CharSeq
sequence.default CharSeq until(CharPredicate terminal)
CharSeq
sequence before the element that satisfies the given predicate, with the previous
element as the last element in this CharSeq
sequence.default CharSeq endingAt(CharPredicate terminal)
CharSeq
sequence at the element that satisfies the given predicate, including the
element as the last element in this CharSeq
sequence.default CharSeq startingAfter(char element)
CharSeq
just after the given element is encountered, not including the element in the
CharSeq
.startingAfter(CharPredicate)
,
startingFrom(char)
default CharSeq startingFrom(char element)
CharSeq
when the given element is encountered, including the element as the first element
in the CharSeq
.startingFrom(CharPredicate)
,
startingAfter(char)
default CharSeq startingAfter(CharPredicate predicate)
CharSeq
just after the given predicate is satisfied, not including the element that
satisfies the predicate in the CharSeq
.startingAfter(char)
,
startingFrom(CharPredicate)
default CharSeq startingFrom(CharPredicate predicate)
CharSeq
when the given predicate is satisfied, including the element that satisfies
the predicate as the first element in the CharSeq
.startingFrom(char)
,
startingAfter(CharPredicate)
default CharSeq map(CharUnaryOperator mapper)
chars
in this CharSeq
to another set of chars
specified by the given
mapper
function.default CharSeq mapIndexed(CharIntToCharFunction mapper)
chars
in this CharSeq
to another set of chars
specified by the given
mapper
function, while providing the current index to the mapper.default Sequence<java.lang.Character> box()
chars
in this CharSeq
to their boxed Character
counterparts.default <T> Sequence<T> toSequence(CharFunction<T> mapper)
default CharSeq skip(int skip)
chars
in this CharSeq
.default CharSeq skipTail(int skip)
chars
at the end of this CharSequence
.default CharSeq limit(int limit)
chars
returned by this CharSeq
.default CharSeq append(char... characters)
chars
to the end of this CharSeq
.default CharSeq append(CharIterable that)
default CharSeq append(java.lang.Iterable<java.lang.Character> iterable)
Character
s in the given Iterable
to the end of this CharSeq
.default CharSeq append(CharIterator iterator)
chars
in the given CharIterator
to the end of this CharSeq
.
The appended chars
will only be available on the first traversal of the resulting CharSeq
.
default CharSeq append(java.util.PrimitiveIterator.OfInt iterator)
chars
in the given PrimitiveIterator.OfInt
to the end of this CharSeq
.
The appended chars
will only be available on the first traversal of the resulting CharSeq
.
default CharSeq append(java.util.Iterator<java.lang.Character> iterator)
Character
s in the given Iterator
to the end of this CharSeq
.
The appended Character
s will only be available on the first traversal of the resulting CharSeq
.
default CharSeq append(java.util.stream.Stream<java.lang.Character> stream)
Character
s in the given Stream
to the end of this CharSeq
.
The appended Character
s will only be available on the first traversal of the resulting CharSeq
.
java.lang.IllegalStateException
- if the Stream
is exhausted.default CharSeq append(java.util.stream.IntStream stream)
char
values of the ints
in the given IntStream
to the end of this
CharSeq
.
The appended chars
will only be available on the first traversal of the resulting CharSeq
.
java.lang.IllegalStateException
- if the Stream
is exhausted.default CharSeq filter(CharPredicate predicate)
CharSeq
, keeping only the elements that match the given
CharPredicate
.default CharSeq filterIndexed(CharIntPredicate predicate)
CharSeq
, keeping only the elements that match the given
CharIntPredicate
, which is passed each double
together with its index in the sequence.default CharSeq filterBack(char firstPrevious, CharBiPredicate predicate)
CharSeq
to another sequence of chars while peeking at the previous value in the
sequence.
The predicate has access to the previous char and the current char in the iteration. If the current char is the first value in the sequence, and there is no previous value, the provided replacement value is used as the first previous value.
default CharSeq filterForward(char lastNext, CharBiPredicate predicate)
CharSeq
to another sequence of chars while peeking at the next char in the sequence.
The predicate has access to the current char and the next char in the iteration. If the current char is the last value in the sequence, and there is no next value, the provided replacement value is used as the last next value.
default CharSeq including(char... elements)
CharSeq
containing only the chars
found in the given target array.default CharSeq excluding(char... elements)
CharSeq
containing only the chars
not found in the given target array.default CharList toList(java.util.function.Supplier<? extends CharList> constructor)
CharSeq
into an CharList
of the type determined by the given
constructor.default CharSet toSet()
CharSeq
into an CharSet
.toSortedSet()
default <S extends CharSet> S toSet(java.util.function.Supplier<? extends S> constructor)
CharSeq
into an CharSet
of the type determined by the given
constructor.default CharSortedSet toSortedSet()
CharSeq
into an CharSortedSet
.default <U extends CharCollection> U toCollection(java.util.function.Supplier<? extends U> constructor)
CharSeq
into an CharCollection
of the type determined by the given constructor.default <C> C collect(java.util.function.Supplier<? extends C> constructor, ObjCharConsumer<? super C> adder)
CharSeq
into an arbitrary container using the given constructor and adder.default <U extends CharCollection> U collectInto(U collection)
CharSeq
into the given CharCollection
.default <C> C collectInto(C result, ObjCharConsumer<? super C> adder)
CharSeq
into the given container using the given adder.default CharList asList()
CharList
view of this CharSeq
, which is updated in real time as the backing
store of the CharSeq
changes. The list does not implement RandomAccess
and is best
accessed in sequence.default java.lang.String join()
CharSeq
into a string.default java.lang.String join(java.lang.String delimiter)
CharSeq
into a string separated by the given delimiter.default java.lang.String join(java.lang.String prefix, java.lang.String delimiter, java.lang.String suffix)
CharSeq
into a string separated by the given delimiter, with the given prefix and suffix.default OptionalChar reduce(CharBinaryOperator operator)
CharSeq
into a single char
by iteratively applying the given binary operator to
the current result and each char
in the sequence.default char reduce(char identity, CharBinaryOperator operator)
CharSeq
into a single char
by iteratively applying the given binary operator to
the current result and each char
in the sequence, starting with the given identity as the initial
result.default OptionalChar first()
CharSeq
or an empty OptionalChar
if there are no characters
in the CharSeq
.default OptionalChar last()
CharSeq
or an empty OptionalChar
if there are no
characters in the CharSeq
.default OptionalChar at(int index)
char
at the given index, or an empty OptionalChar
if the CharSeq
is
smaller than the index.default OptionalChar first(CharPredicate predicate)
CharSeq
matching the given predicate, or an empty
OptionalChar
if there are no matching chars in the CharSeq
.filter(CharPredicate)
,
at(int, CharPredicate)
default OptionalChar last(CharPredicate predicate)
CharSeq
matching the given predicate, or an empty
OptionalChar
if there are no matching chars in the CharSeq
.filter(CharPredicate)
,
at(int, CharPredicate)
default OptionalChar at(int index, CharPredicate predicate)
char
at the given index out of chars matching the given predicate, or an empty
OptionalChar
if the matching CharSeq
is smaller than the index.filter(CharPredicate)
default CharSeq step(int step)
CharSeq
.default CharSeq distinct()
CharSeq
where each item occurs only once, the first time it is encountered.default OptionalChar min()
CharSeq
according to their integer value.default OptionalChar max()
CharSeq
according to their integer value.default int size()
size
in interface java.util.Collection<java.lang.Character>
CharSeq
.default java.util.Spliterator<java.lang.Character> spliterator()
spliterator
in interface java.util.Collection<java.lang.Character>
spliterator
in interface java.lang.Iterable<java.lang.Character>
Spliterator
for this CharSeq
.default java.util.Spliterator.OfInt intSpliterator()
intSpliterator
in interface CharCollection
intSpliterator
in interface CharIterable
Spliterator.OfInt
for this CharSeq
.default boolean all(CharPredicate predicate)
CharSeq
satisfy the given predicate, false otherwise.default boolean none(CharPredicate predicate)
CharSeq
satisfy the given predicate, false otherwise.default boolean any(CharPredicate predicate)
CharSeq
satisfy the given predicate, false otherwise.default CharSeq peek(CharConsumer action)
CharConsumer
to see each element in this CharSeq
as it is traversed.default CharSeq peekIndexed(CharIntConsumer action)
CharIntConsumer
to see each element together with its index in this CharSeq
as
it is traversed.default CharSeq sorted()
CharSeq
sorted according to the natural order of the characters' integer values.reverse()
default CharSeq prefix(char... cs)
CharSeq
with the given characters.default CharSeq suffix(char... cs)
CharSeq
with the given characters.default CharSeq interleave(CharIterable that)
CharSeq
with those of the given CharIterable
, stopping when
either sequence finishes.default CharSeq reverse()
CharSeq
which iterates over this CharSeq
in reverse order.sorted()
default java.lang.String asString()
CharSeq
concatenated as a string.join(String)
,
join(String, String, String)
,
collect(Supplier, ObjCharConsumer)
default CharSeq mapBack(char firstPrevious, CharBinaryOperator mapper)
CharSeq
to another sequence of characters while peeking at the previous character in the
sequence.
The mapper has access to the previous char and the current char in the iteration. If the current char is the first value in the sequence, and there is no previous value, the provided replacement value is used as the first previous value.
default CharSeq mapForward(char lastNext, CharBinaryOperator mapper)
CharSeq
to another sequence of characters while peeking at the next character in the sequence.
The mapper has access to the current char and the next char in the iteration. If the current char is the last value in the sequence, and there is no next value, the provided replacement value is used as the last next value.
default IntSequence toInts()
default IntSequence toInts(CharToIntFunction mapper)
default CharSeq repeat()
The resulting sequence will never terminate if this sequence is non-empty.
default CharSeq repeat(int times)
default Sequence<CharSeq> window(int window)
CharSeq
into a sequence of CharSeq
s of elements, each with the size
of the given window. The first item in each list is the second item in the previous list. The final list may
be shorter than the window. This is equivalent to window(window, 1)
.default Sequence<CharSeq> window(int window, int step)
Sequence
into a sequence of CharSeq
s of elements, each with the size
of the given window, stepping step
elements between each window. If the given step is less than the
window size, the windows will overlap each other.default Sequence<CharSeq> batch(int size)
Sequence
into a sequence of CharSeq
s of distinct elements, each with
the given batch size. This is equivalent to window(size, size)
.default Sequence<CharSeq> batch(CharBiPredicate predicate)
Sequence
into a sequence of CharSeq
s of distinct elements, where the
given predicate determines where to split the lists of partitioned elements. The predicate is given the current
and next item in the iteration, and if it returns true a partition is created between the elements.default Sequence<CharSeq> split(char element)
chars
of this CharSeq
into a sequence of CharSeq
s of distinct elements, around
the given char
. The elements around which the sequence is split are not included in the result.default Sequence<CharSeq> split(CharPredicate predicate)
chars
of this CharSeq
charo a sequence of CharSeq
s of distinct elements, where
the given predicate determines which chars
to split the partitioned elements around. The chars
matching the predicate are not included in the result.default boolean isEmpty()
isEmpty
in interface CharCollection
isEmpty
in interface CharIterable
isEmpty
in interface java.util.Collection<java.lang.Character>
CharSeq
is empty, false otherwise.default void forEachCharIndexed(CharIntConsumer action)
char
in this CharSeq
, with the index of each element passed
as the second parameter in the action.