public abstract class CharStream
extends java.lang.Object
int
primitive specialization of
Stream
.
The following example illustrates an aggregate operation using
Stream
and CharStream
, computing the sum of the weights of the
red widgets:
int sum = widgets.stream()
.filter(w -> w.getColor() == RED)
.mapToChar(w -> w.getWeight())
.sum();
See the class documentation for Stream
and the package documentation
for java.util.stream for additional
specification of streams, stream operations, stream pipelines, and
parallelism.Stream
,
java.util.streamBaseStream.Splitor
Modifier and Type | Method and Description |
---|---|
<R> R |
__(Function<? super CharStream,R> transfer) |
abstract <E extends java.lang.Exception> |
allMatch(Try.CharPredicate<E> predicate) |
abstract <E extends java.lang.Exception> |
anyMatch(Try.CharPredicate<E> predicate) |
abstract IntStream |
asIntStream()
Returns a
LongStream consisting of the elements of this stream,
converted to long . |
abstract OptionalDouble |
average() |
abstract Stream<java.lang.Character> |
boxed()
Returns a
Stream consisting of the elements of this stream,
each boxed to an Chareger . |
S |
carry(C action)
Same as
peek |
void |
close()
Closes this stream, causing all close handlers for this stream pipeline
to be called.
|
abstract CharStream |
collapse(CharBiPredicate collapsible,
CharBiFunction<java.lang.Character> mergeFunction)
Merge series of adjacent elements which satisfy the given predicate using
the merger function and return a new stream.
|
abstract <R> R |
collect(Supplier<R> supplier,
ObjCharConsumer<R> accumulator) |
abstract <R> R |
collect(Supplier<R> supplier,
ObjCharConsumer<R> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
static CharStream |
concat(char[]... a) |
static CharStream |
concat(CharIterator... a) |
static CharStream |
concat(CharStream... a) |
static CharStream |
concat(java.util.Collection<? extends CharStream> c) |
static CharStream |
empty() |
abstract <E extends java.lang.Exception> |
findAny(Try.CharPredicate<E> predicate) |
abstract <E extends java.lang.Exception> |
findFirst(Try.CharPredicate<E> predicate) |
abstract <E extends java.lang.Exception,E2 extends java.lang.Exception> |
findFirstOrLast(Try.CharPredicate<E> predicateForFirst,
Try.CharPredicate<E> predicateForLast) |
abstract <E extends java.lang.Exception> |
findLast(Try.CharPredicate<E> predicate) |
abstract CharStream |
flatMap(CharFunction<? extends CharStream> mapper)
Returns a stream consisting of the results of replacing each element of
this stream with the contents of a mapped stream produced by applying
the provided mapping function to each element.
|
abstract IntStream |
flatMapToInt(CharFunction<? extends IntStream> mapper) |
abstract <T> Stream<T> |
flatMapToObj(CharFunction<? extends Stream<T>> mapper) |
abstract CharStream |
flattMap(CharFunction<char[]> mapper) |
abstract <E extends java.lang.Exception> |
forEach(Try.CharConsumer<E> action) |
static CharStream |
generate(CharSupplier s) |
abstract OptionalChar |
head()
Head and tail should be used by pair.
|
abstract Pair<OptionalChar,CharStream> |
headAndTail() |
abstract Pair<CharStream,OptionalChar> |
headAndTaill() |
abstract CharStream |
headd()
Head2 and tail2 should be used by pair.
|
boolean |
isParallel()
Returns whether this stream, if a terminal operation were to be executed,
would execute in parallel.
|
static CharStream |
iterate(char seed,
CharPredicate hasNext,
CharUnaryOperator f) |
static CharStream |
iterate(char seed,
CharUnaryOperator f) |
static CharStream |
iterate(char seed,
Supplier<java.lang.Boolean> hasNext,
CharUnaryOperator f) |
static CharStream |
iterate(Supplier<java.lang.Boolean> hasNext,
CharSupplier next) |
CharIterator |
iterator()
Returns an iterator for the elements of this stream.
|
abstract OptionalChar |
kthLargest(int k) |
abstract CharStream |
map(CharUnaryOperator mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
abstract IntStream |
mapToInt(CharToIntFunction mapper)
Returns a
IntStream consisting of the results of applying the
given function to the elements of this stream. |
abstract <U> Stream<U> |
mapToObj(CharFunction<? extends U> mapper)
Returns an object-valued
Stream consisting of the results of
applying the given function to the elements of this stream. |
abstract OptionalChar |
max()
Returns an
OptionalChar describing the maximum element of this
stream, or an empty optional if this stream is empty. |
int |
maxThreadNum()
Return the underlying
maxThreadNum if the stream is parallel, otherwise 1 is returned. |
S |
maxThreadNum(int maxThreadNum)
Returns a parallel stream with the specified
maxThreadNum . |
static CharStream |
merge(char[] a,
char[] b,
char[] c,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
merge(char[] a,
char[] b,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
merge(CharIterator a,
CharIterator b,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
merge(CharIterator a,
CharIterator b,
CharIterator c,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
abstract CharStream |
merge(CharStream b,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
merge(CharStream a,
CharStream b,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
merge(CharStream a,
CharStream b,
CharStream c,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
merge(java.util.Collection<? extends CharStream> c,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
abstract OptionalChar |
min()
Returns an
OptionalChar describing the minimum element of this
stream, or an empty optional if this stream is empty. |
abstract <E extends java.lang.Exception> |
noneMatch(Try.CharPredicate<E> predicate) |
static CharStream |
of(char... a) |
static CharStream |
of(char[][] a) |
static CharStream |
of(char[][][] a) |
static CharStream |
of(char[] a,
int startIndex,
int endIndex) |
static CharStream |
of(CharIterator iterator) |
static CharStream |
of(java.lang.CharSequence str)
Takes the chars in the specified String as the elements of the Stream
|
static CharStream |
of(java.lang.CharSequence str,
int startIndex,
int endIndex)
Takes the chars in the specified String as the elements of the Stream
|
static CharStream |
of(Supplier<CharList> supplier)
Lazy evaluation.
|
S |
parallel()
Returns an equivalent stream that is parallel.
|
S |
parallel(BaseStream.Splitor splitor)
Returns an equivalent stream that is parallel.
|
S |
parallel(int maxThreadNum)
Returns an equivalent stream that is parallel.
|
static CharStream |
parallelMerge(java.util.Collection<? extends CharStream> c,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static CharStream |
parallelMerge(java.util.Collection<? extends CharStream> c,
CharBiFunction<com.landawn.abacus.util.Nth> nextSelector,
int maxThreadNum) |
void |
println() |
static CharStream |
random() |
static CharStream |
random(char[] candicates) |
static CharStream |
random(char startInclusive,
char endExclusive) |
static CharStream |
range(char startInclusive,
char endExclusive) |
static CharStream |
range(char startInclusive,
char endExclusive,
int by) |
static CharStream |
rangeClosed(char startInclusive,
char endInclusive) |
static CharStream |
rangeClosed(char startInclusive,
char endInclusive,
int by) |
abstract OptionalChar |
reduce(CharBinaryOperator op)
Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
OptionalChar describing the reduced value,
if any. |
abstract char |
reduce(char identity,
CharBinaryOperator op)
Performs a reduction on the
elements of this stream, using the provided identity value and an
associative
accumulation function, and returns the reduced value.
|
static CharStream |
repeat(char element,
long n) |
abstract CharStream |
scan(CharBiFunction<java.lang.Character> accumulator)
Returns a
Stream produced by iterative application of a accumulation function
to an initial element seed and next element of the current stream. |
abstract CharStream |
scan(char seed,
CharBiFunction<java.lang.Character> accumulator)
Returns a
Stream produced by iterative application of a accumulation function
to an initial element seed and next element of the current stream. |
S |
sequential()
Returns an equivalent stream that is sequential.
|
Stream<S> |
sliding(int windowSize) |
Stream<PL> |
slidingToList(int windowSize) |
BaseStream.Splitor |
splitor()
Return the underlying
splitor if the stream is parallel, otherwise the default value splitor.ITERATOR is returned. |
S |
splitor(BaseStream.Splitor splitor)
Returns a parallel stream with the specified
splitor . |
abstract long |
sum() |
abstract com.landawn.abacus.util.CharSummaryStatistics |
summarize() |
abstract Pair<com.landawn.abacus.util.CharSummaryStatistics,Optional<java.util.Map<com.landawn.abacus.util.Percentage,java.lang.Character>>> |
summarizze() |
abstract CharStream |
tail()
Head and tail should be used by pair.
|
abstract OptionalChar |
taill()
Head2 and tail2 should be used by pair.
|
abstract CharList |
toCharList() |
abstract <K,U> java.util.Map<K,U> |
toMap(CharFunction<? extends K> keyExtractor,
CharFunction<? extends U> valueMapper) |
abstract <K,U> java.util.Map<K,U> |
toMap(CharFunction<? extends K> keyExtractor,
CharFunction<? extends U> valueMapper,
BinaryOperator<U> mergeFunction) |
abstract <K,U,M extends java.util.Map<K,U>> |
toMap(CharFunction<? extends K> keyExtractor,
CharFunction<? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory) |
abstract <K,U,M extends java.util.Map<K,U>> |
toMap(CharFunction<? extends K> keyExtractor,
CharFunction<? extends U> valueMapper,
Supplier<M> mapFactory) |
abstract <K,A,D> java.util.Map<K,D> |
toMap(CharFunction<? extends K> classifier,
Collector<java.lang.Character,A,D> downstream) |
abstract <K,A,D,M extends java.util.Map<K,D>> |
toMap(CharFunction<? extends K> classifier,
Collector<java.lang.Character,A,D> downstream,
Supplier<M> mapFactory) |
abstract CharMatrix |
toMatrix() |
Try<S> |
tried() |
static CharStream |
zip(char[] a,
char[] b,
char[] c,
char valueForNoneA,
char valueForNoneB,
char valueForNoneC,
CharTriFunction<java.lang.Character> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static CharStream |
zip(char[] a,
char[] b,
char[] c,
CharTriFunction<java.lang.Character> zipFunction)
Zip together the "a", "b" and "c" arrays until one of them runs out of values.
|
static CharStream |
zip(char[] a,
char[] b,
CharBiFunction<java.lang.Character> zipFunction)
Zip together the "a" and "b" arrays until one of them runs out of values.
|
static CharStream |
zip(char[] a,
char[] b,
char valueForNoneA,
char valueForNoneB,
CharBiFunction<java.lang.Character> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static CharStream |
zip(CharIterator a,
CharIterator b,
CharBiFunction<java.lang.Character> zipFunction)
Zip together the "a" and "b" iterators until one of them runs out of values.
|
static CharStream |
zip(CharIterator a,
CharIterator b,
char valueForNoneA,
char valueForNoneB,
CharBiFunction<java.lang.Character> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static CharStream |
zip(CharIterator a,
CharIterator b,
CharIterator c,
char valueForNoneA,
char valueForNoneB,
char valueForNoneC,
CharTriFunction<java.lang.Character> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static CharStream |
zip(CharIterator a,
CharIterator b,
CharIterator c,
CharTriFunction<java.lang.Character> zipFunction)
Zip together the "a", "b" and "c" iterators until one of them runs out of values.
|
static CharStream |
zip(CharStream a,
CharStream b,
CharBiFunction<java.lang.Character> zipFunction)
Zip together the "a" and "b" streams until one of them runs out of values.
|
static CharStream |
zip(CharStream a,
CharStream b,
char valueForNoneA,
char valueForNoneB,
CharBiFunction<java.lang.Character> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static CharStream |
zip(CharStream a,
CharStream b,
CharStream c,
char valueForNoneA,
char valueForNoneB,
char valueForNoneC,
CharTriFunction<java.lang.Character> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static CharStream |
zip(CharStream a,
CharStream b,
CharStream c,
CharTriFunction<java.lang.Character> zipFunction)
Zip together the "a", "b" and "c" streams until one of them runs out of values.
|
static CharStream |
zip(java.util.Collection<? extends CharStream> c,
char[] valuesForNone,
CharNFunction<java.lang.Character> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static CharStream |
zip(java.util.Collection<? extends CharStream> c,
CharNFunction<java.lang.Character> zipFunction)
Zip together the iterators until one of them runs out of values.
|
abstract CharStream |
zipWith(CharStream b,
CharBiFunction<java.lang.Character> zipFunction) |
abstract CharStream |
zipWith(CharStream b,
char valueForNoneA,
char valueForNoneB,
CharBiFunction<java.lang.Character> zipFunction) |
abstract CharStream |
zipWith(CharStream b,
CharStream c,
char valueForNoneA,
char valueForNoneB,
char valueForNoneC,
CharTriFunction<java.lang.Character> zipFunction) |
abstract CharStream |
zipWith(CharStream b,
CharStream c,
CharTriFunction<java.lang.Character> zipFunction) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
append, cached, count, difference, distinct, dropWhile, filter, first, indexed, intersection, join, join, last, limit, onClose, parallel, peek, percentiles, prepend, remove, removeIf, removeIf, removeWhile, reversed, reverseSorted, rotated, shuffled, shuffled, skip, sliding, slidingToList, sorted, split, split, split, splitAt, splitBy, splitToList, splitToList, splitToList, step, symmetricDifference, takeWhile, toArray, toList, toList, toLongMultiset, toLongMultiset, toMultiset, toMultiset, toSet, toSet
public abstract CharStream map(CharUnaryOperator mapper)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract IntStream mapToInt(CharToIntFunction mapper)
IntStream
consisting of the results of applying the
given function to the elements of this stream.
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract <U> Stream<U> mapToObj(CharFunction<? extends U> mapper)
Stream
consisting of the results of
applying the given function to the elements of this stream.
This is an intermediate operation.
U
- the element type of the new streammapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract CharStream flatMap(CharFunction<? extends CharStream> mapper)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each element which produces an
CharStream
of new valuesStream.flatMap(Function)
public abstract CharStream flattMap(CharFunction<char[]> mapper)
public abstract IntStream flatMapToInt(CharFunction<? extends IntStream> mapper)
public abstract <T> Stream<T> flatMapToObj(CharFunction<? extends Stream<T>> mapper)
public abstract CharStream collapse(CharBiPredicate collapsible, CharBiFunction<java.lang.Character> mergeFunction)
collapsible
- mergeFunction
- public abstract CharStream scan(CharBiFunction<java.lang.Character> accumulator)
Stream
produced by iterative application of a accumulation function
to an initial element seed
and next element of the current stream.
Produces a Stream
consisting of seed
, acc(seed, value1)
,
acc(acc(seed, value1), value2)
, etc.
This is an intermediate operation.
Example:
accumulator: (a, b) -> a + b stream: [1, 2, 3, 4, 5] result: [1, 3, 6, 10, 15]
accumulator
- the accumulation functionpublic abstract CharStream scan(char seed, CharBiFunction<java.lang.Character> accumulator)
Stream
produced by iterative application of a accumulation function
to an initial element seed
and next element of the current stream.
Produces a Stream
consisting of seed
, acc(seed, value1)
,
acc(acc(seed, value1), value2)
, etc.
This is an intermediate operation.
Example:
seed:10 accumulator: (a, b) -> a + b stream: [1, 2, 3, 4, 5] result: [11, 13, 16, 20, 25]
seed
- the initial value. it's only used once by accumulator
to calculate the fist element in the returned stream.
It will be ignored if this stream is empty and won't be the first element of the returned stream.accumulator
- the accumulation functionpublic abstract CharList toCharList()
public abstract <K,U> java.util.Map<K,U> toMap(CharFunction<? extends K> keyExtractor, CharFunction<? extends U> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMap(Function, Function)
public abstract <K,U,M extends java.util.Map<K,U>> M toMap(CharFunction<? extends K> keyExtractor, CharFunction<? extends U> valueMapper, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mapFactory
- Collectors.toMap(Function, Function, Supplier)
public abstract <K,U> java.util.Map<K,U> toMap(CharFunction<? extends K> keyExtractor, CharFunction<? extends U> valueMapper, BinaryOperator<U> mergeFunction)
keyExtractor
- valueMapper
- mergeFunction
- Collectors.toMap(Function, Function, BinaryOperator)
public abstract <K,U,M extends java.util.Map<K,U>> M toMap(CharFunction<? extends K> keyExtractor, CharFunction<? extends U> valueMapper, BinaryOperator<U> mergeFunction, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mergeFunction
- mapFactory
- Collectors.toMap(Function, Function, BinaryOperator, Supplier)
public abstract <K,A,D> java.util.Map<K,D> toMap(CharFunction<? extends K> classifier, Collector<java.lang.Character,A,D> downstream)
classifier
- downstream
- Collectors.groupingBy(Function, Collector)
public abstract <K,A,D,M extends java.util.Map<K,D>> M toMap(CharFunction<? extends K> classifier, Collector<java.lang.Character,A,D> downstream, Supplier<M> mapFactory)
classifier
- downstream
- mapFactory
- Collectors.groupingBy(Function, Collector, Supplier)
public abstract CharMatrix toMatrix()
public abstract char reduce(char identity, CharBinaryOperator op)
int result = identity;
for (int element : this stream)
result = accumulator.applyAsChar(result, element)
return result;
but is not constrained to execute sequentially.
The identity
value must be an identity for the accumulator
function. This means that for all x
,
accumulator.apply(identity, x)
is equal to x
.
The accumulator
function must be an
associative function.
This is a terminal operation.
identity
- the identity value for the accumulating functionop
- an associative,
non-interfering,
stateless
function for combining two valuessum()
,
min()
,
max()
,
average()
public abstract OptionalChar reduce(CharBinaryOperator op)
OptionalChar
describing the reduced value,
if any. This is equivalent to:
boolean foundAny = false;
int result = null;
for (int element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.applyAsChar(result, element);
}
return foundAny ? OptionalChar.of(result) : OptionalChar.empty();
but is not constrained to execute sequentially.
The accumulator
function must be an
associative function.
This is a terminal operation.
op
- an associative,
non-interfering,
stateless
function for combining two values#reduce(int, CharBinaryOperator)
public abstract <R> R collect(Supplier<R> supplier, ObjCharConsumer<R> accumulator, BiConsumer<R,R> combiner)
ArrayList
, and elements are incorporated by updating
the state of the result rather than by replacing the result. This
produces a result equivalent to:
R result = supplier.get();
for (int element : this stream)
accumulator.accept(result, element);
return result;
Like #reduce(int, CharBinaryOperator)
, collect
operations
can be parallelized without requiring additional synchronization.
This is a terminal operation.
R
- type of the resultsupplier
- a function that creates a new result container. For a
parallel execution, this function may be called
multiple times and must return a fresh value each time.accumulator
- an associative,
non-interfering,
stateless
function for incorporating an additional element into a resultcombiner
- an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator functionStream.collect(Supplier, BiConsumer, BiConsumer)
public abstract <R> R collect(Supplier<R> supplier, ObjCharConsumer<R> accumulator)
supplier
- accumulator
- public abstract <E extends java.lang.Exception> void forEach(Try.CharConsumer<E> action) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception> boolean anyMatch(Try.CharPredicate<E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception> boolean allMatch(Try.CharPredicate<E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception> boolean noneMatch(Try.CharPredicate<E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception> OptionalChar findFirst(Try.CharPredicate<E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception> OptionalChar findLast(Try.CharPredicate<E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception,E2 extends java.lang.Exception> OptionalChar findFirstOrLast(Try.CharPredicate<E> predicateForFirst, Try.CharPredicate<E> predicateForLast) throws E extends java.lang.Exception, E2 extends java.lang.Exception
E extends java.lang.Exception
public abstract <E extends java.lang.Exception> OptionalChar findAny(Try.CharPredicate<E> predicate) throws E extends java.lang.Exception
E extends java.lang.Exception
public abstract OptionalChar head()
public abstract CharStream tail()
public abstract CharStream headd()
public abstract OptionalChar taill()
public abstract Pair<OptionalChar,CharStream> headAndTail()
public abstract Pair<CharStream,OptionalChar> headAndTaill()
public abstract OptionalChar min()
OptionalChar
describing the minimum element of this
stream, or an empty optional if this stream is empty. This is a special
case of a reduction
and is equivalent to:
return reduce(Chareger::min);
This is a terminal operation.
OptionalChar
containing the minimum element of this
stream, or an empty OptionalChar
if the stream is emptypublic abstract OptionalChar max()
OptionalChar
describing the maximum element of this
stream, or an empty optional if this stream is empty. This is a special
case of a reduction
and is equivalent to:
return reduce(Chareger::max);
This is a terminal operation.
OptionalChar
containing the maximum element of this
stream, or an empty OptionalChar
if the stream is emptypublic abstract OptionalChar kthLargest(int k)
k
- public abstract long sum()
public abstract OptionalDouble average()
public abstract com.landawn.abacus.util.CharSummaryStatistics summarize()
public abstract Pair<com.landawn.abacus.util.CharSummaryStatistics,Optional<java.util.Map<com.landawn.abacus.util.Percentage,java.lang.Character>>> summarizze()
public abstract CharStream merge(CharStream b, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public abstract CharStream zipWith(CharStream b, CharBiFunction<java.lang.Character> zipFunction)
public abstract CharStream zipWith(CharStream b, CharStream c, CharTriFunction<java.lang.Character> zipFunction)
public abstract CharStream zipWith(CharStream b, char valueForNoneA, char valueForNoneB, CharBiFunction<java.lang.Character> zipFunction)
public abstract CharStream zipWith(CharStream b, CharStream c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<java.lang.Character> zipFunction)
public abstract IntStream asIntStream()
LongStream
consisting of the elements of this stream,
converted to long
.
This is an intermediate operation.
LongStream
consisting of the elements of this stream,
converted to long
public abstract Stream<java.lang.Character> boxed()
Stream
consisting of the elements of this stream,
each boxed to an Chareger
.
This is an intermediate operation.
Stream
consistent of the elements of this stream,
each boxed to an Chareger
public CharIterator iterator()
BaseStream
public <R> R __(Function<? super CharStream,R> transfer)
public static CharStream empty()
@SafeVarargs public static CharStream of(char... a)
public static CharStream of(char[] a, int startIndex, int endIndex)
public static CharStream of(char[][] a)
public static CharStream of(char[][][] a)
public static CharStream of(CharIterator iterator)
public static CharStream of(java.lang.CharSequence str)
str
- public static CharStream of(java.lang.CharSequence str, int startIndex, int endIndex)
str
- startIndex
- endIndex
- public static CharStream of(Supplier<CharList> supplier)
supplier
- public static CharStream range(char startInclusive, char endExclusive)
public static CharStream range(char startInclusive, char endExclusive, int by)
public static CharStream rangeClosed(char startInclusive, char endInclusive)
public static CharStream rangeClosed(char startInclusive, char endInclusive, int by)
public static CharStream repeat(char element, long n)
public static CharStream random()
public static CharStream random(char startInclusive, char endExclusive)
public static CharStream random(char[] candicates)
public static CharStream iterate(Supplier<java.lang.Boolean> hasNext, CharSupplier next)
public static CharStream iterate(char seed, Supplier<java.lang.Boolean> hasNext, CharUnaryOperator f)
public static CharStream iterate(char seed, CharPredicate hasNext, CharUnaryOperator f)
seed
- hasNext
- test if has next by hasNext.test(seed) for first time and hasNext.test(f.apply(previous)) for remaining.f
- public static CharStream iterate(char seed, CharUnaryOperator f)
public static CharStream generate(CharSupplier s)
@SafeVarargs public static CharStream concat(char[]... a)
@SafeVarargs public static CharStream concat(CharIterator... a)
@SafeVarargs public static CharStream concat(CharStream... a)
public static CharStream concat(java.util.Collection<? extends CharStream> c)
public static CharStream zip(char[] a, char[] b, CharBiFunction<java.lang.Character> zipFunction)
a
- b
- public static CharStream zip(char[] a, char[] b, char[] c, CharTriFunction<java.lang.Character> zipFunction)
a
- b
- public static CharStream zip(CharIterator a, CharIterator b, CharBiFunction<java.lang.Character> zipFunction)
a
- b
- public static CharStream zip(CharIterator a, CharIterator b, CharIterator c, CharTriFunction<java.lang.Character> zipFunction)
a
- b
- public static CharStream zip(CharStream a, CharStream b, CharBiFunction<java.lang.Character> zipFunction)
a
- b
- public static CharStream zip(CharStream a, CharStream b, CharStream c, CharTriFunction<java.lang.Character> zipFunction)
a
- b
- public static CharStream zip(java.util.Collection<? extends CharStream> c, CharNFunction<java.lang.Character> zipFunction)
c
- zipFunction
- public static CharStream zip(char[] a, char[] b, char valueForNoneA, char valueForNoneB, CharBiFunction<java.lang.Character> zipFunction)
a
- b
- valueForNoneA
- value to fill if "a" runs out of values first.valueForNoneB
- value to fill if "b" runs out of values first.zipFunction
- public static CharStream zip(char[] a, char[] b, char[] c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<java.lang.Character> zipFunction)
a
- b
- c
- valueForNoneA
- value to fill if "a" runs out of values.valueForNoneB
- value to fill if "b" runs out of values.valueForNoneC
- value to fill if "c" runs out of values.zipFunction
- public static CharStream zip(CharIterator a, CharIterator b, char valueForNoneA, char valueForNoneB, CharBiFunction<java.lang.Character> zipFunction)
a
- b
- valueForNoneA
- value to fill if "a" runs out of values first.valueForNoneB
- value to fill if "b" runs out of values first.zipFunction
- public static CharStream zip(CharIterator a, CharIterator b, CharIterator c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<java.lang.Character> zipFunction)
a
- b
- c
- valueForNoneA
- value to fill if "a" runs out of values.valueForNoneB
- value to fill if "b" runs out of values.valueForNoneC
- value to fill if "c" runs out of values.zipFunction
- public static CharStream zip(CharStream a, CharStream b, char valueForNoneA, char valueForNoneB, CharBiFunction<java.lang.Character> zipFunction)
a
- b
- valueForNoneA
- value to fill if "a" runs out of values first.valueForNoneB
- value to fill if "b" runs out of values first.zipFunction
- public static CharStream zip(CharStream a, CharStream b, CharStream c, char valueForNoneA, char valueForNoneB, char valueForNoneC, CharTriFunction<java.lang.Character> zipFunction)
a
- b
- c
- valueForNoneA
- value to fill if "a" runs out of values.valueForNoneB
- value to fill if "b" runs out of values.valueForNoneC
- value to fill if "c" runs out of values.zipFunction
- public static CharStream zip(java.util.Collection<? extends CharStream> c, char[] valuesForNone, CharNFunction<java.lang.Character> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static CharStream merge(char[] a, char[] b, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream merge(char[] a, char[] b, char[] c, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
a
- b
- c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream merge(CharIterator a, CharIterator b, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream merge(CharIterator a, CharIterator b, CharIterator c, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
a
- b
- c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream merge(CharStream a, CharStream b, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
a
- b
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream merge(CharStream a, CharStream b, CharStream c, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
a
- b
- c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream merge(java.util.Collection<? extends CharStream> c, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream parallelMerge(java.util.Collection<? extends CharStream> c, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.public static CharStream parallelMerge(java.util.Collection<? extends CharStream> c, CharBiFunction<com.landawn.abacus.util.Nth> nextSelector, int maxThreadNum)
c
- nextSelector
- first parameter is selected if Nth.FIRST
is returned, otherwise the second parameter is selected.maxThreadNum
- public S carry(C action)
BaseStream
peek
carry
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.peek(Object)
public Stream<S> sliding(int windowSize)
sliding
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.sliding(int, int)
public Stream<PL> slidingToList(int windowSize)
slidingToList
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.sliding(int, int)
public void println()
println
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public boolean isParallel()
BaseStream
isParallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
true
if this stream would execute in parallel if executedpublic S sequential()
BaseStream
sequential
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public S parallel()
BaseStream
parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.parallel(int, Splitor)
public S parallel(int maxThreadNum)
BaseStream
maxThreadNum
as the specified one.parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.parallel(int, Splitor)
public S parallel(BaseStream.Splitor splitor)
BaseStream
splitor
as the specified one.parallel
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
BaseStream.parallel(int, Splitor)
public int maxThreadNum()
BaseStream
maxThreadNum
if the stream is parallel, otherwise 1
is returned.maxThreadNum
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public S maxThreadNum(int maxThreadNum)
BaseStream
maxThreadNum
. Or return
itself, either because the stream was already parallel with same maxThreadNum
, or because
it's a sequential stream.maxThreadNum
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public BaseStream.Splitor splitor()
BaseStream
splitor
if the stream is parallel, otherwise the default value splitor.ITERATOR
is returned.splitor
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public S splitor(BaseStream.Splitor splitor)
BaseStream
splitor
. Or return
itself, either because the stream was already parallel with same splitor
, or because
it's a sequential stream.splitor
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public Try<S> tried()
tried
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
public void close()
BaseStream
close
in interface BaseStream<T,A,P,C,PL,OT,IT,S extends com.landawn.abacus.util.stream.StreamBase<T,A,P,C,PL,OT,IT,S>>
close
in interface java.lang.AutoCloseable
AutoCloseable.close()