public abstract class FloatStream
extends java.lang.Object
float
primitive specialization of
Stream
.
The following example illustrates an aggregate operation using
Stream
and FloatStream
, computing the sum of the weights of the
red widgets:
float sum = widgets.stream()
.filter(w -> w.getColor() == RED)
.mapToFloat(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 FloatStream,R> transfer) |
abstract DoubleStream |
asDoubleStream()
Returns a
DoubleStream consisting of the elements of this stream,
converted to double . |
abstract OptionalDouble |
average()
Returns an
OptionalFloat describing the arithmetic
mean of elements of this stream, or an empty optional if this
stream is empty. |
abstract Stream<java.lang.Float> |
boxed()
Returns a
Stream consisting of the elements of this stream,
boxed to Float . |
S |
carry(C action)
Same as
peek |
void |
close()
Closes this stream, causing all close handlers for this stream pipeline
to be called.
|
abstract FloatStream |
collapse(FloatBiPredicate collapsible,
FloatBiFunction<java.lang.Float> 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,
ObjFloatConsumer<R> accumulator) |
abstract <R> R |
collect(Supplier<R> supplier,
ObjFloatConsumer<R> accumulator,
BiConsumer<R,R> combiner)
Performs a mutable
reduction operation on the elements of this stream.
|
static FloatStream |
concat(java.util.Collection<? extends FloatStream> c) |
static FloatStream |
concat(float[]... a) |
static FloatStream |
concat(FloatIterator... a) |
static FloatStream |
concat(FloatStream... a) |
static FloatStream |
empty() |
OT |
findAny(P predicate)
Returns an
Optional describing some element of the stream, or an
empty Optional if the stream is empty. |
abstract FloatStream |
flatArray(FloatFunction<float[]> mapper) |
abstract FloatStream |
flatMap(FloatFunction<? extends FloatStream> 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 DoubleStream |
flatMapToDouble(FloatFunction<? extends DoubleStream> mapper) |
abstract IntStream |
flatMapToInt(FloatFunction<? extends IntStream> mapper) |
abstract LongStream |
flatMapToLong(FloatFunction<? extends LongStream> mapper) |
abstract <T> Stream<T> |
flatMapToObj(FloatFunction<? extends Stream<T>> mapper) |
static FloatStream |
generate(FloatSupplier s) |
abstract OptionalFloat |
head()
Head and tail should be used by pair.
|
abstract FloatStream |
head2()
Head2 and tail2 should be used by pair.
|
abstract Pair<OptionalFloat,FloatStream> |
headAndTail() |
abstract Pair<FloatStream,OptionalFloat> |
headAndTail2() |
boolean |
isParallel()
Returns whether this stream, if a terminal operation were to be executed,
would execute in parallel.
|
static FloatStream |
iterate(float seed,
FloatPredicate hasNext,
FloatUnaryOperator f) |
static FloatStream |
iterate(float seed,
FloatUnaryOperator f) |
static FloatStream |
iterate(float seed,
Supplier<java.lang.Boolean> hasNext,
FloatUnaryOperator f) |
static FloatStream |
iterate(Supplier<java.lang.Boolean> hasNext,
FloatSupplier next) |
FloatIterator |
iterator()
Returns an iterator for the elements of this stream.
|
abstract OptionalFloat |
kthLargest(int k) |
abstract FloatStream |
map(FloatUnaryOperator mapper)
Returns a stream consisting of the results of applying the given
function to the elements of this stream.
|
abstract DoubleStream |
mapToDouble(FloatToDoubleFunction mapper)
Returns a
DoubleStream consisting of the results of applying the
given function to the elements of this stream. |
abstract IntStream |
mapToInt(FloatToIntFunction mapper)
Returns an
IntStream consisting of the results of applying the
given function to the elements of this stream. |
abstract LongStream |
mapToLong(FloatToLongFunction mapper)
Returns a
LongStream consisting of the results of applying the
given function to the elements of this stream. |
abstract <U> Stream<U> |
mapToObj(FloatFunction<? extends U> mapper)
Returns an object-valued
Stream consisting of the results of
applying the given function to the elements of this stream. |
abstract OptionalFloat |
max()
Returns an
OptionalFloat describing the maximum element of this
stream, or an empty OptionalFloat 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 FloatStream |
merge(java.util.Collection<? extends FloatStream> c,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
merge(float[] a,
float[] b,
float[] c,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
merge(float[] a,
float[] b,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
merge(FloatIterator a,
FloatIterator b,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
merge(FloatIterator a,
FloatIterator b,
FloatIterator c,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
abstract FloatStream |
merge(FloatStream b,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
merge(FloatStream a,
FloatStream b,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
merge(FloatStream a,
FloatStream b,
FloatStream c,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
abstract OptionalFloat |
min()
Returns an
OptionalFloat describing the minimum element of this
stream, or an empty OptionalFloat if this stream is empty. |
static FloatStream |
of(float... a) |
static FloatStream |
of(float[][] a) |
static FloatStream |
of(float[][][] a) |
static FloatStream |
of(float[] a,
int startIndex,
int endIndex) |
static FloatStream |
of(FloatIterator iterator) |
static FloatStream |
of(Supplier<FloatList> 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 FloatStream |
parallelMerge(java.util.Collection<? extends FloatStream> c,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector) |
static FloatStream |
parallelMerge(java.util.Collection<? extends FloatStream> c,
FloatBiFunction<com.landawn.abacus.util.Nth> nextSelector,
int maxThreadNum) |
void |
println() |
static FloatStream |
random() |
abstract OptionalFloat |
reduce(FloatBinaryOperator op)
Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
OptionalFloat describing the reduced
value, if any. |
abstract float |
reduce(float identity,
FloatBinaryOperator 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 FloatStream |
repeat(float element,
long n) |
abstract FloatStream |
scan(FloatBiFunction<java.lang.Float> 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 FloatStream |
scan(float seed,
FloatBiFunction<java.lang.Float> 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 double |
sum()
Returns the sum of elements in this stream.
|
abstract com.landawn.abacus.util.FloatSummaryStatistics |
summarize() |
abstract Pair<com.landawn.abacus.util.FloatSummaryStatistics,Optional<java.util.Map<com.landawn.abacus.util.Percentage,java.lang.Float>>> |
summarize2() |
abstract FloatStream |
tail()
Head and tail should be used by pair.
|
abstract OptionalFloat |
tail2()
Head2 and tail2 should be used by pair.
|
abstract FloatList |
toFloatList() |
abstract <K,A,D> java.util.Map<K,D> |
toMap(FloatFunction<? extends K> classifier,
Collector<java.lang.Float,A,D> downstream) |
abstract <K,A,D,M extends java.util.Map<K,D>> |
toMap(FloatFunction<? extends K> classifier,
Collector<java.lang.Float,A,D> downstream,
Supplier<M> mapFactory) |
abstract <K,U> java.util.Map<K,U> |
toMap(FloatFunction<? extends K> keyExtractor,
FloatFunction<? extends U> valueMapper) |
abstract <K,U> java.util.Map<K,U> |
toMap(FloatFunction<? extends K> keyExtractor,
FloatFunction<? extends U> valueMapper,
BinaryOperator<U> mergeFunction) |
abstract <K,U,M extends java.util.Map<K,U>> |
toMap(FloatFunction<? extends K> keyExtractor,
FloatFunction<? extends U> valueMapper,
BinaryOperator<U> mergeFunction,
Supplier<M> mapFactory) |
abstract <K,U,M extends java.util.Map<K,U>> |
toMap(FloatFunction<? extends K> keyExtractor,
FloatFunction<? extends U> valueMapper,
Supplier<M> mapFactory) |
abstract FloatMatrix |
toMatrix() |
abstract FloatStream |
top(int n)
This method only run sequentially, even in parallel stream. |
abstract FloatStream |
top(int n,
java.util.Comparator<? super java.lang.Float> comparator)
This method only run sequentially, even in parallel stream. |
Try<S> |
tried() |
static FloatStream |
zip(java.util.Collection<? extends FloatStream> c,
float[] valuesForNone,
FloatNFunction<java.lang.Float> zipFunction)
Zip together the iterators until all of them runs out of values.
|
static FloatStream |
zip(java.util.Collection<? extends FloatStream> c,
FloatNFunction<java.lang.Float> zipFunction)
Zip together the iterators until one of them runs out of values.
|
static FloatStream |
zip(float[] a,
float[] b,
float[] c,
float valueForNoneA,
float valueForNoneB,
float valueForNoneC,
FloatTriFunction<java.lang.Float> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static FloatStream |
zip(float[] a,
float[] b,
float[] c,
FloatTriFunction<java.lang.Float> zipFunction)
Zip together the "a", "b" and "c" arrays until one of them runs out of values.
|
static FloatStream |
zip(float[] a,
float[] b,
FloatBiFunction<java.lang.Float> zipFunction)
Zip together the "a" and "b" arrays until one of them runs out of values.
|
static FloatStream |
zip(float[] a,
float[] b,
float valueForNoneA,
float valueForNoneB,
FloatBiFunction<java.lang.Float> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static FloatStream |
zip(FloatIterator a,
FloatIterator b,
FloatBiFunction<java.lang.Float> zipFunction)
Zip together the "a" and "b" iterators until one of them runs out of values.
|
static FloatStream |
zip(FloatIterator a,
FloatIterator b,
float valueForNoneA,
float valueForNoneB,
FloatBiFunction<java.lang.Float> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static FloatStream |
zip(FloatIterator a,
FloatIterator b,
FloatIterator c,
float valueForNoneA,
float valueForNoneB,
float valueForNoneC,
FloatTriFunction<java.lang.Float> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static FloatStream |
zip(FloatIterator a,
FloatIterator b,
FloatIterator c,
FloatTriFunction<java.lang.Float> zipFunction)
Zip together the "a", "b" and "c" iterators until one of them runs out of values.
|
static FloatStream |
zip(FloatStream a,
FloatStream b,
FloatBiFunction<java.lang.Float> zipFunction)
Zip together the "a" and "b" streams until one of them runs out of values.
|
static FloatStream |
zip(FloatStream a,
FloatStream b,
float valueForNoneA,
float valueForNoneB,
FloatBiFunction<java.lang.Float> zipFunction)
Zip together the "a" and "b" iterators until all of them runs out of values.
|
static FloatStream |
zip(FloatStream a,
FloatStream b,
FloatStream c,
float valueForNoneA,
float valueForNoneB,
float valueForNoneC,
FloatTriFunction<java.lang.Float> zipFunction)
Zip together the "a", "b" and "c" iterators until all of them runs out of values.
|
static FloatStream |
zip(FloatStream a,
FloatStream b,
FloatStream c,
FloatTriFunction<java.lang.Float> zipFunction)
Zip together the "a", "b" and "c" streams until one of them runs out of values.
|
abstract FloatStream |
zipWith(FloatStream b,
FloatBiFunction<java.lang.Float> zipFunction) |
abstract FloatStream |
zipWith(FloatStream b,
float valueForNoneA,
float valueForNoneB,
FloatBiFunction<java.lang.Float> zipFunction) |
abstract FloatStream |
zipWith(FloatStream b,
FloatStream c,
float valueForNoneA,
float valueForNoneB,
float valueForNoneC,
FloatTriFunction<java.lang.Float> zipFunction) |
abstract FloatStream |
zipWith(FloatStream b,
FloatStream c,
FloatTriFunction<java.lang.Float> zipFunction) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
allMatch, anyMatch, append, cached, count, difference, distinct, dropWhile, filter, findFirst, findFirstOrLast, findLast, first, forEach, indexed, intersection, join, join, last, limit, noneMatch, 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 FloatStream map(FloatUnaryOperator mapper)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each elementpublic abstract IntStream mapToInt(FloatToIntFunction 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 LongStream mapToLong(FloatToLongFunction mapper)
LongStream
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 DoubleStream mapToDouble(FloatToDoubleFunction mapper)
DoubleStream
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(FloatFunction<? 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 FloatStream flatMap(FloatFunction<? extends FloatStream> mapper)
This is an intermediate operation.
mapper
- a non-interfering,
stateless
function to apply to each element which produces a
FloatStream
of new valuesStream.flatMap(Function)
public abstract FloatStream flatArray(FloatFunction<float[]> mapper)
public abstract IntStream flatMapToInt(FloatFunction<? extends IntStream> mapper)
public abstract LongStream flatMapToLong(FloatFunction<? extends LongStream> mapper)
public abstract DoubleStream flatMapToDouble(FloatFunction<? extends DoubleStream> mapper)
public abstract <T> Stream<T> flatMapToObj(FloatFunction<? extends Stream<T>> mapper)
public abstract FloatStream collapse(FloatBiPredicate collapsible, FloatBiFunction<java.lang.Float> mergeFunction)
collapsible
- mergeFunction
- public abstract FloatStream scan(FloatBiFunction<java.lang.Float> 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 FloatStream scan(float seed, FloatBiFunction<java.lang.Float> 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 FloatStream top(int n)
n
- public abstract FloatStream top(int n, java.util.Comparator<? super java.lang.Float> comparator)
n
- public abstract FloatList toFloatList()
public abstract <K,U> java.util.Map<K,U> toMap(FloatFunction<? extends K> keyExtractor, FloatFunction<? extends U> valueMapper)
keyExtractor
- valueMapper
- Collectors.toMap(Function, Function)
public abstract <K,U,M extends java.util.Map<K,U>> M toMap(FloatFunction<? extends K> keyExtractor, FloatFunction<? extends U> valueMapper, Supplier<M> mapFactory)
keyExtractor
- valueMapper
- mapFactory
- Collectors.toMap(Function, Function, Supplier)
public abstract <K,U> java.util.Map<K,U> toMap(FloatFunction<? extends K> keyExtractor, FloatFunction<? 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(FloatFunction<? extends K> keyExtractor, FloatFunction<? 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(FloatFunction<? extends K> classifier, Collector<java.lang.Float,A,D> downstream)
classifier
- downstream
- Collectors.groupingBy(Function, Collector)
public abstract <K,A,D,M extends java.util.Map<K,D>> M toMap(FloatFunction<? extends K> classifier, Collector<java.lang.Float,A,D> downstream, Supplier<M> mapFactory)
classifier
- downstream
- mapFactory
- Collectors.groupingBy(Function, Collector, Supplier)
public abstract FloatMatrix toMatrix()
public abstract float reduce(float identity, FloatBinaryOperator op)
float result = identity;
for (float element : this stream)
result = accumulator.applyAsFloat(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 OptionalFloat reduce(FloatBinaryOperator op)
OptionalFloat
describing the reduced
value, if any. This is equivalent to:
boolean foundAny = false;
float result = null;
for (float element : this stream) {
if (!foundAny) {
foundAny = true;
result = element;
}
else
result = accumulator.applyAsFloat(result, element);
}
return foundAny ? OptionalFloat.of(result) : OptionalFloat.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 valuesreduce(float, FloatBinaryOperator)
public abstract <R> R collect(Supplier<R> supplier, ObjFloatConsumer<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 (float element : this stream)
accumulator.accept(result, element);
return result;
Like reduce(float, FloatBinaryOperator)
, 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, ObjFloatConsumer<R> accumulator)
supplier
- accumulator
- public abstract OptionalFloat head()
public abstract FloatStream tail()
public abstract FloatStream head2()
public abstract OptionalFloat tail2()
public abstract Pair<OptionalFloat,FloatStream> headAndTail()
public abstract Pair<FloatStream,OptionalFloat> headAndTail2()
public abstract OptionalFloat min()
OptionalFloat
describing the minimum element of this
stream, or an empty OptionalFloat if this stream is empty. The minimum
element will be Float.NaN
if any stream element was NaN. Unlike
the numerical comparison operators, this method considers negative zero
to be strictly smaller than positive zero. This is a special case of a
reduction and is
equivalent to:
return reduce(Float::min);
This is a terminal operation.
OptionalFloat
containing the minimum element of this
stream, or an empty optional if the stream is emptypublic abstract OptionalFloat max()
OptionalFloat
describing the maximum element of this
stream, or an empty OptionalFloat if this stream is empty. The maximum
element will be Float.NaN
if any stream element was NaN. Unlike
the numerical comparison operators, this method considers negative zero
to be strictly smaller than positive zero. This is a
special case of a
reduction and is
equivalent to:
return reduce(Float::max);
This is a terminal operation.
OptionalFloat
containing the maximum element of this
stream, or an empty optional if the stream is emptypublic abstract OptionalFloat kthLargest(int k)
k
- public abstract double sum()
return reduce(0, Float::sum);
However, since floating-point summation is not exact, the above
code is not necessarily equivalent to the summation computation
done by this method.
If any stream element is a NaN or the sum is at any point a NaN
then the sum will be NaN.
The value of a floating-point sum is a function both
of the input values as well as the order of addition
operations. The order of addition operations of this method is
intentionally not defined to allow for implementation
flexibility to improve the speed and accuracy of the computed
result.
In particular, this method may be implemented using compensated
summation or other technique to reduce the error bound in the
numerical sum compared to a simple summation of float
values.
This is a terminal operation.
public abstract OptionalDouble average()
OptionalFloat
describing the arithmetic
mean of elements of this stream, or an empty optional if this
stream is empty.
If any recorded value is a NaN or the sum is at any point a NaN
then the average will be NaN.
The average returned can vary depending upon the order in
which values are recorded.
This method may be implemented using compensated summation or
other technique to reduce the error bound in the numerical sum
used to compute the average.
The average is a special case of a reduction.
This is a terminal operation.
OptionalFloat
containing the average element of this
stream, or an empty optional if the stream is emptypublic abstract com.landawn.abacus.util.FloatSummaryStatistics summarize()
public abstract Pair<com.landawn.abacus.util.FloatSummaryStatistics,Optional<java.util.Map<com.landawn.abacus.util.Percentage,java.lang.Float>>> summarize2()
public abstract FloatStream merge(FloatStream b, FloatBiFunction<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 FloatStream zipWith(FloatStream b, FloatBiFunction<java.lang.Float> zipFunction)
public abstract FloatStream zipWith(FloatStream b, FloatStream c, FloatTriFunction<java.lang.Float> zipFunction)
public abstract FloatStream zipWith(FloatStream b, float valueForNoneA, float valueForNoneB, FloatBiFunction<java.lang.Float> zipFunction)
public abstract FloatStream zipWith(FloatStream b, FloatStream c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<java.lang.Float> zipFunction)
public abstract DoubleStream asDoubleStream()
DoubleStream
consisting of the elements of this stream,
converted to double
.
This is an intermediate operation.
DoubleStream
consisting of the elements of this stream,
converted to double
public abstract Stream<java.lang.Float> boxed()
Stream
consisting of the elements of this stream,
boxed to Float
.
This is an intermediate operation.
Stream
consistent of the elements of this stream,
each boxed to a Float
public FloatIterator iterator()
BaseStream
public <R> R __(Function<? super FloatStream,R> transfer)
public static FloatStream empty()
@SafeVarargs public static FloatStream of(float... a)
public static FloatStream of(float[] a, int startIndex, int endIndex)
public static FloatStream of(float[][] a)
public static FloatStream of(float[][][] a)
public static FloatStream of(FloatIterator iterator)
public static FloatStream of(Supplier<FloatList> supplier)
supplier
- public static FloatStream repeat(float element, long n)
public static FloatStream random()
public static FloatStream iterate(Supplier<java.lang.Boolean> hasNext, FloatSupplier next)
public static FloatStream iterate(float seed, Supplier<java.lang.Boolean> hasNext, FloatUnaryOperator f)
public static FloatStream iterate(float seed, FloatPredicate hasNext, FloatUnaryOperator 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 FloatStream iterate(float seed, FloatUnaryOperator f)
public static FloatStream generate(FloatSupplier s)
@SafeVarargs public static FloatStream concat(float[]... a)
@SafeVarargs public static FloatStream concat(FloatIterator... a)
@SafeVarargs public static FloatStream concat(FloatStream... a)
public static FloatStream concat(java.util.Collection<? extends FloatStream> c)
public static FloatStream zip(float[] a, float[] b, FloatBiFunction<java.lang.Float> zipFunction)
a
- b
- public static FloatStream zip(float[] a, float[] b, float[] c, FloatTriFunction<java.lang.Float> zipFunction)
a
- b
- public static FloatStream zip(FloatIterator a, FloatIterator b, FloatBiFunction<java.lang.Float> zipFunction)
a
- b
- public static FloatStream zip(FloatIterator a, FloatIterator b, FloatIterator c, FloatTriFunction<java.lang.Float> zipFunction)
a
- b
- public static FloatStream zip(FloatStream a, FloatStream b, FloatBiFunction<java.lang.Float> zipFunction)
a
- b
- public static FloatStream zip(FloatStream a, FloatStream b, FloatStream c, FloatTriFunction<java.lang.Float> zipFunction)
a
- b
- public static FloatStream zip(java.util.Collection<? extends FloatStream> c, FloatNFunction<java.lang.Float> zipFunction)
c
- zipFunction
- public static FloatStream zip(float[] a, float[] b, float valueForNoneA, float valueForNoneB, FloatBiFunction<java.lang.Float> 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 FloatStream zip(float[] a, float[] b, float[] c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<java.lang.Float> 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 FloatStream zip(FloatIterator a, FloatIterator b, float valueForNoneA, float valueForNoneB, FloatBiFunction<java.lang.Float> 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 FloatStream zip(FloatIterator a, FloatIterator b, FloatIterator c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<java.lang.Float> 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 FloatStream zip(FloatStream a, FloatStream b, float valueForNoneA, float valueForNoneB, FloatBiFunction<java.lang.Float> 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 FloatStream zip(FloatStream a, FloatStream b, FloatStream c, float valueForNoneA, float valueForNoneB, float valueForNoneC, FloatTriFunction<java.lang.Float> 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 FloatStream zip(java.util.Collection<? extends FloatStream> c, float[] valuesForNone, FloatNFunction<java.lang.Float> zipFunction)
c
- valuesForNone
- value to fill for any iterator runs out of values.zipFunction
- public static FloatStream merge(float[] a, float[] b, FloatBiFunction<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 FloatStream merge(float[] a, float[] b, float[] c, FloatBiFunction<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 FloatStream merge(FloatIterator a, FloatIterator b, FloatBiFunction<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 FloatStream merge(FloatIterator a, FloatIterator b, FloatIterator c, FloatBiFunction<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 FloatStream merge(FloatStream a, FloatStream b, FloatBiFunction<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 FloatStream merge(FloatStream a, FloatStream b, FloatStream c, FloatBiFunction<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 FloatStream merge(java.util.Collection<? extends FloatStream> c, FloatBiFunction<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 FloatStream parallelMerge(java.util.Collection<? extends FloatStream> c, FloatBiFunction<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 FloatStream parallelMerge(java.util.Collection<? extends FloatStream> c, FloatBiFunction<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 OT findAny(P predicate)
BaseStream
Optional
describing some element of the stream, or an
empty Optional
if the stream is empty.
This is a short-circuiting terminal operation.
The behavior of this operation is explicitly nondeterministic; it is
free to select any element in the stream. This is to allow for maximal
performance in parallel operations; the cost is that multiple invocations
on the same source may not return the same result. (If a stable result
is desired, use #findFirst()
instead.)
findAny
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>>
Optional
describing some element of this stream, or an
empty Optional
if the stream is empty#findFirst()
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()