IntStreamDecorator wraps a Java IntStream and registers a closeHandler
which is passed further to any resulting Stream.
The goal of the IntStreamDecorator is to close the underlying IntStream upon
calling a terminal operation.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | allMatch(IntPredicate
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public boolean | anyMatch(IntPredicate
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public DoubleStream | asDoubleStream()
Implements java. DoubleStream consisting of the elements of this stream,
converted to double.
|
| public LongStream | asLongStream()
Implements java. LongStream consisting of the elements of this stream,
converted to long.
|
| public OptionalDouble | average()
Implements java. OptionalDouble describing the arithmetic mean of elements of
this stream, or an empty optional if this stream is empty.
|
| public Stream | boxed()
Implements java. Stream consisting of the elements of this stream,
each boxed to an Integer.
|
| public void | close()
Implements java. |
| public <R> R | collect(Supplier<R>
a function that creates a new mutable result container.
For a parallel execution, this function may be called
multiple times and must return a fresh value each time. supplier, ObjIntConsumer<R> an associative,
non-interfering,
stateless
function that must fold an element into a result
container. accumulator, BiConsumer<R, R> an associative,
non-interfering,
stateless
function that accepts two partial result containers
and merges them, which must be compatible with the
accumulator function. The combiner function must fold
the elements from the second result container into the
first result container. combiner)Implements java. |
| public long | |
| public IntStream | distinct()
Implements java. |
| public IntStream | filter(IntPredicate
a non-interfering,
stateless
predicate to apply to each element to determine if it
should be included predicate)Implements java. |
| public OptionalInt | findAny()
Implements java. OptionalInt describing some element of the stream, or
an empty OptionalInt if the stream is empty.
|
| public OptionalInt | findFirst()
Implements java. OptionalInt describing the first element of this
stream, or an empty OptionalInt if the stream is empty.
|
| public IntStream | flatMap(IntFunction<? extends IntStream>
a non-interfering,
stateless
function to apply to each element which produces an
mapper)IntStream of new valuesImplements java. |
| public void | forEach(IntConsumer
a
non-interfering action to perform on the elements action)Implements java. |
| public void | forEachOrdered(IntConsumer
a
non-interfering action to perform on the elements action)Implements java. |
| public boolean | isParallel()
Implements java. |
| public PrimitiveIterator. | iterator()
Implements java. |
| public IntStream | limit(long
the number of elements the stream should be limited to maxSize)Implements java. maxSize in length.
|
| public IntStream | map(IntUnaryOperator
a non-interfering,
stateless
function to apply to each element mapper)Implements java. |
| public DoubleStream | mapToDouble(IntToDoubleFunction
a non-interfering,
stateless
function to apply to each element mapper)Implements java. DoubleStream consisting of the results of applying the
given function to the elements of this stream.
|
| public LongStream | mapToLong(IntToLongFunction
a non-interfering,
stateless
function to apply to each element mapper)Implements java. LongStream consisting of the results of applying the
given function to the elements of this stream.
|
| public <U> Stream | mapToObj(IntFunction<? extends U>
a non-interfering,
stateless
function to apply to each element mapper)Implements java. Stream consisting of the results of
applying the given function to the elements of this stream.
|
| public OptionalInt | max()
Implements java. OptionalInt describing the maximum element of this
stream, or an empty optional if this stream is empty.
|
| public OptionalInt | min()
Implements java. OptionalInt describing the minimum element of this
stream, or an empty optional if this stream is empty.
|
| public boolean | noneMatch(IntPredicate
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public IntStream | onClose(Runnable
A task to execute when the stream is closed closeHandler)Implements java. |
| public IntStream | parallel()
Implements java. |
| public IntStream | peek(IntConsumer
a
non-interfering action to perform on the elements as
they are consumed from the stream action)Implements java. |
| public int | reduce(int
the identity value for the accumulating function identity, IntBinaryOperator op)Implements java. |
| public OptionalInt | reduce(IntBinaryOperator op)
Implements java. OptionalInt describing the reduced value,
if any.
|
| public IntStream | sequential()
Implements java. |
| public IntStream | skip(long
the number of leading elements to skip n)Implements java. n elements of the stream.
|
| public IntStream | sorted()
Implements java. |
| public Spliterator. | spliterator()
Implements java. |
| public int | |
| public IntSummaryStatistics | summaryStatistics()
Implements java. IntSummaryStatistics describing various
summary data about the elements of this stream.
|
| public int[] | toArray()
Implements java. |
| public IntStream | unordered()
Implements java. |
| closeHandler | back to summary |
|---|---|
| private final Runnable closeHandler | |
| delegate | back to summary |
|---|---|
| private final IntStream delegate | |
| IntStreamDecorator | back to summary |
|---|---|
| public IntStreamDecorator(IntStream delegate, Runnable closeHandler) | |
| allMatch | back to summary |
|---|---|
| public boolean allMatch(IntPredicate predicate) Implements java. Doc from java. Returns whether all elements of this stream match the provided predicate.
May not evaluate the predicate on all elements if not necessary for
determining the result. If the stream is empty then This is a short-circuiting terminal operation.
| |
| anyMatch | back to summary |
|---|---|
| public boolean anyMatch(IntPredicate predicate) Implements java. Doc from java. Returns whether any elements of this stream match the provided
predicate. May not evaluate the predicate on all elements if not
necessary for determining the result. If the stream is empty then
This is a short-circuiting terminal operation.
| |
| asDoubleStream | back to summary |
|---|---|
| public DoubleStream asDoubleStream() Implements java. Doc from java. Returns a This is an intermediate operation.
| |
| asLongStream | back to summary |
|---|---|
| public LongStream asLongStream() Implements java. Doc from java. Returns a This is an intermediate operation.
| |
| average | back to summary |
|---|---|
| public OptionalDouble average() Implements java. Doc from java. Returns an This is a terminal operation.
| |
| boxed | back to summary |
|---|---|
| public Stream Implements java. Doc from java. Returns a This is an intermediate operation. | |
| close | back to summary |
|---|---|
| public void close() Implements java. Doc from java. Closes this stream, causing all close handlers for this stream pipeline to be called.
| |
| collect | back to summary |
|---|---|
| public <R> R collect(Supplier<R> supplier, ObjIntConsumer<R> accumulator, BiConsumer<R, R> combiner) Implements java. Doc from java. Performs a mutable
reduction operation on the elements of this stream. A mutable
reduction is one in which the reduced value is a mutable result container,
such as an
Like This is a terminal operation.
| |
| count | back to summary |
|---|---|
| public long count() Implements java. Doc from java. Returns the count of elements in this stream. This is a special case of a reduction and is equivalent to:
This is a terminal operation.
| |
| distinct | back to summary |
|---|---|
| public IntStream distinct() Implements java. Doc from java. Returns a stream consisting of the distinct elements of this stream. This is a stateful intermediate operation. | |
| filter | back to summary |
|---|---|
| public IntStream filter(IntPredicate predicate) Implements java. Doc from java. Returns a stream consisting of the elements of this stream that match the given predicate. This is an intermediate operation.
| |
| findAny | back to summary |
|---|---|
| public OptionalInt findAny() Implements java. Doc from java. Returns an 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 | back to summary |
|---|---|
| public OptionalInt findFirst() Implements java. Doc from java. Returns an This is a short-circuiting terminal operation.
| |
| flatMap | back to summary |
|---|---|
| public IntStream flatMap(IntFunction<? extends IntStream> mapper) Implements java. Doc from java. 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. Each mapped stream is
This is an intermediate operation.
| |
| forEach | back to summary |
|---|---|
| public void forEach(IntConsumer action) Implements java. Doc from java. Performs an action for each element of this stream. This is a terminal operation. For parallel stream pipelines, this operation does not guarantee to respect the encounter order of the stream, as doing so would sacrifice the benefit of parallelism. For any given element, the action may be performed at whatever time and in whatever thread the library chooses. If the action accesses shared state, it is responsible for providing the required synchronization.
| |
| forEachOrdered | back to summary |
|---|---|
| public void forEachOrdered(IntConsumer action) Implements java. Doc from java. Performs an action for each element of this stream, guaranteeing that each element is processed in encounter order for streams that have a defined encounter order. This is a terminal operation.
| |
| isParallel | back to summary |
|---|---|
| public boolean isParallel() Implements java. Doc from java. Returns whether this stream, if a terminal operation were to be executed, would execute in parallel. Calling this method after invoking an terminal stream operation method may yield unpredictable results.
| |
| iterator | back to summary |
|---|---|
| public PrimitiveIterator. Implements java. Doc from java. Returns an iterator for the elements of this stream. This is a terminal operation.
| |
| limit | back to summary |
|---|---|
| public IntStream limit(long maxSize) Implements java. Doc from java. Returns a stream consisting of the elements of this stream, truncated
to be no longer than | |
| map | back to summary |
|---|---|
| public IntStream map(IntUnaryOperator mapper) Implements java. Doc from java. Returns a stream consisting of the results of applying the given function to the elements of this stream. This is an intermediate operation.
| |
| mapToDouble | back to summary |
|---|---|
| public DoubleStream mapToDouble(IntToDoubleFunction mapper) Implements java. Doc from java. Returns a This is an intermediate operation.
| |
| mapToLong | back to summary |
|---|---|
| public LongStream mapToLong(IntToLongFunction mapper) Implements java. Doc from java. Returns a This is an intermediate operation.
| |
| mapToObj | back to summary |
|---|---|
| public <U> Stream Implements java. Doc from java. Returns an object-valued This is an intermediate operation.
| |
| max | back to summary |
|---|---|
| public OptionalInt max() Implements java. Doc from java. Returns an
This is a terminal operation.
| |
| min | back to summary |
|---|---|
| public OptionalInt min() Implements java. Doc from java. Returns an
This is a terminal operation.
| |
| noneMatch | back to summary |
|---|---|
| public boolean noneMatch(IntPredicate predicate) Implements java. Doc from java. Returns whether no elements of this stream match the provided predicate.
May not evaluate the predicate on all elements if not necessary for
determining the result. If the stream is empty then This is a short-circuiting terminal operation.
| |
| onClose | back to summary |
|---|---|
| public IntStream onClose(Runnable closeHandler) Implements java. Doc from java. Returns an equivalent stream with an additional close handler. Close
handlers are run when the This is an intermediate operation. | |
| parallel | back to summary |
|---|---|
| public IntStream parallel() Implements java. Doc from java. Returns an equivalent stream that is parallel. May return itself, either because the stream was already parallel, or because the underlying stream state was modified to be parallel. This is an intermediate operation. | |
| peek | back to summary |
|---|---|
| public IntStream peek(IntConsumer action) Implements java. Doc from java. Returns a stream consisting of the elements of this stream, additionally performing the provided action on each element as elements are consumed from the resulting stream. This is an intermediate operation. For parallel stream pipelines, the action may be called at whatever time and in whatever thread the element is made available by the upstream operation. If the action modifies shared state, it is responsible for providing the required synchronization.
| |
| reduce | back to summary |
|---|---|
| public int reduce(int identity, IntBinaryOperator op) Implements java. Doc from java. Performs a reduction on the elements of this stream, using the provided identity value and an associative accumulation function, and returns the reduced value. This is equivalent to:
but is not constrained to execute sequentially.
The This is a terminal operation.
| |
| reduce | back to summary |
|---|---|
| public OptionalInt reduce(IntBinaryOperator op) Implements java. Doc from java. Performs a reduction on the
elements of this stream, using an
associative accumulation
function, and returns an
but is not constrained to execute sequentially.
The This is a terminal operation.
| |
| sequential | back to summary |
|---|---|
| public IntStream sequential() Implements java. Doc from java. Returns an equivalent stream that is sequential. May return itself, either because the stream was already sequential, or because the underlying stream state was modified to be sequential. This is an intermediate operation. | |
| skip | back to summary |
|---|---|
| public IntStream skip(long n) Implements java. Doc from java. Returns a stream consisting of the remaining elements of this stream
after discarding the first This is a stateful intermediate operation. | |
| sorted | back to summary |
|---|---|
| public IntStream sorted() Implements java. Doc from java. Returns a stream consisting of the elements of this stream in sorted order. This is a stateful intermediate operation. | |
| spliterator | back to summary |
|---|---|
| public Spliterator. Implements java. Doc from java. Returns a spliterator for the elements of this stream. This is a terminal operation.
| |
| sum | back to summary |
|---|---|
| public int sum() Implements java. Doc from java. Returns the sum of elements in this stream. This is a special case of a reduction and is equivalent to:
This is a terminal operation.
| |
| summaryStatistics | back to summary |
|---|---|
| public IntSummaryStatistics summaryStatistics() Implements java. Doc from java. Returns an This is a terminal operation.
| |
| toArray | back to summary |
|---|---|
| public int[] toArray() Implements java. Doc from java. Returns an array containing the elements of this stream. This is a terminal operation.
| |
| unordered | back to summary |
|---|---|
| public IntStream unordered() Implements java. Doc from java. Returns an equivalent stream that is unordered. May return itself, either because the stream was already unordered, or because the underlying stream state was modified to be unordered. This is an intermediate operation. | |