T
- the type of the stream elements
S
- the type of the stream implementing BaseStream
AutoCloseable
DoubleStream
, IntStream
, LongStream
, Stream<T>
Base interface for streams, which are sequences of elements supporting sequential and parallel aggregate operations. The following example illustrates an aggregate operation using the stream types
Stream
and
IntStream
, computing the sum of the weights of the red widgets:
int sum = widgets.stream()
.filter(w -> w.getColor() == RED)
.mapToInt(w -> w.getWeight())
.sum();
See the class documentation for
Stream
and the package documentation for
java.util.streamfor additional specification of streams, stream operations, stream pipelines, and parallelism, which governs the behavior of all stream types.
void
Closes this stream, causing all close handlers for this stream pipeline to be called.
boolean
Returns whether this stream, if a terminal operation were to be executed, would execute in parallel.
Returns an iterator for the elements of this stream.
Returns an equivalent stream with an additional close handler.
Returns an equivalent stream that is parallel.
Returns an equivalent stream that is sequential.
Returns a spliterator for the elements of this stream.
Returns an equivalent stream that is
unordered.
This is a terminal operation.
Returns a spliterator for the elements of this stream.
This is a terminal operation.
The returned spliterator should report the set of characteristics derived from the stream pipeline (namely the characteristics derived from the stream source spliterator and the intermediate operations). Implementations may report a sub-set of those characteristics. For example, it may be too expensive to compute the entire set for some or all possible stream pipelines.
boolean isParallel()
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.
true
if this stream would execute in parallel if executed
This is an intermediate operation.
This is an intermediate operation.
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.
Returns an equivalent stream with an additional close handler. Close handlers are run when the
close()
method is called on the stream, and are executed in the order they were added. All close handlers are run, even if earlier close handlers throw exceptions. If any close handler throws an exception, the first exception thrown will be relayed to the caller of
close()
, with any remaining exceptions added to that exception as suppressed exceptions (unless one of the remaining exceptions is the same exception as the first exception, since an exception cannot suppress itself.) May return itself.
This is an intermediate operation.
closeHandler
- A task to execute when the stream is closed
void close()
Closes this stream, causing all close handlers for this stream pipeline to be called.
close
in interface AutoCloseable
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4