StreamDecorator wraps a Java Stream and registers a closeHandler
which is passed further to any resulting Stream.
The goal of the StreamDecorator is to close the underlying Stream upon
calling a terminal operation.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | allMatch(Predicate<? super R>
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public boolean | anyMatch(Predicate<? super R>
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public void | close()
Implements java. |
| public <R1> R1 | collect(Supplier<R1>
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, BiConsumer<R1, ? super R> an associative,
non-interfering,
stateless
function that must fold an element into a result
container. accumulator, BiConsumer<R1, R1> 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 <R1, A> R1 | collect(Collector<? super R, A, R1>
the collector)Collector describing the reductionImplements java. Collector.
|
| public long | |
| public Stream | distinct()
Implements java. Object#equals(Object)) of this stream.
|
| public Stream | dropWhile(Predicate<? super R>
a non-interfering,
stateless
predicate to apply to elements to determine the longest
prefix of elements. predicate)Overrides default java. |
| public Stream | filter(Predicate<? super R>
a non-interfering,
stateless
predicate to apply to each element to determine if it
should be included predicate)Implements java. |
| public Optional | findAny()
Implements java. Optional describing some element of the stream, or an
empty Optional if the stream is empty.
|
| public Optional | findFirst()
Implements java. Optional describing the first element of this stream,
or an empty Optional if the stream is empty.
|
| public <R1> Stream | flatMap(Function<? super R, ? extends Stream<? extends R1>>
a non-interfering,
stateless
function to apply to each element which produces a stream
of new values mapper)Implements java. |
| public DoubleStream | flatMapToDouble(Function<? super R, ? extends DoubleStream>
a non-interfering,
stateless
function to apply to each element which produces a stream
of new values mapper)Implements java. DoubleStream 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.
|
| public IntStream | flatMapToInt(Function<? super R, ? extends IntStream>
a non-interfering,
stateless
function to apply to each element which produces a stream
of new values mapper)Implements java. IntStream 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.
|
| public LongStream | flatMapToLong(Function<? super R, ? extends LongStream>
a non-interfering,
stateless
function to apply to each element which produces a stream
of new values mapper)Implements java. LongStream 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.
|
| public void | forEach(Consumer<? super R>
a
non-interfering action to perform on the elements action)Implements java. |
| public void | forEachOrdered(Consumer<? super R>
a
non-interfering action to perform on the elements action)Implements java. |
| public boolean | isParallel()
Implements java. |
| public Iterator | iterator()
Implements java. |
| public Stream | limit(long
the number of elements the stream should be limited to maxSize)Implements java. maxSize in length.
|
| public <R1> Stream | map(Function<? super R, ? extends R1>
a non-interfering,
stateless
function to apply to each element mapper)Implements java. |
| public DoubleStream | mapToDouble(ToDoubleFunction<? super R>
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 IntStream | mapToInt(ToIntFunction<? super R>
a non-interfering,
stateless
function to apply to each element mapper)Implements java. IntStream consisting of the results of applying the
given function to the elements of this stream.
|
| public LongStream | mapToLong(ToLongFunction<? super R>
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 Optional | max(Comparator<? super R> comparator)
Implements java. Comparator.
|
| public Optional | min(Comparator<? super R> comparator)
Implements java. Comparator.
|
| public boolean | noneMatch(Predicate<? super R>
a non-interfering,
stateless
predicate to apply to elements of this stream predicate)Implements java. |
| public Stream | onClose(Runnable
A task to execute when the stream is closed closeHandler)Implements java. |
| public Stream | parallel()
Implements java. |
| public Stream | peek(Consumer<? super R>
a
non-interfering action to perform on the elements as
they are consumed from the stream action)Implements java. |
| public R | reduce(R
the identity value for the accumulating function identity, BinaryOperator<R> accumulator)Implements java. |
| public Optional | reduce(BinaryOperator<R> accumulator)
Implements java. Optional describing the reduced value,
if any.
|
| public <U> U | reduce(U
the identity value for the combiner function identity, BiFunction<U, ? super R, U> an associative,
non-interfering,
stateless
function for incorporating an additional element into a result accumulator, BinaryOperator<U> an associative,
non-interfering,
stateless
function for combining two values, which must be
compatible with the accumulator function combiner)Implements java. |
| public Stream | sequential()
Implements java. |
| public Stream | skip(long
the number of leading elements to skip n)Implements java. n elements of the stream.
|
| public Stream | sorted()
Implements java. |
| public Stream | sorted(Comparator<? super R> comparator)
Implements java. Comparator.
|
| public Spliterator | spliterator()
Implements java. |
| public Stream | takeWhile(Predicate<? super R>
a non-interfering,
stateless
predicate to apply to elements to determine the longest
prefix of elements. predicate)Overrides default java. |
| public Object[] | toArray()
Implements java. |
| public <A> A[] | toArray(IntFunction<A[]>
a function which produces a new array of the desired
type and the provided length generator)Implements java. generator function to allocate the returned array, as
well as any additional arrays that might be required for a partitioned
execution or for resizing.
|
| public Stream | unordered()
Implements java. |