public class StreamComposition extends Object
Constructor and Description |
---|
StreamComposition() |
Modifier and Type | Method and Description |
---|---|
static <T> Stream<T> |
concat(Stream<T>... streams)
Creates a concatenated Stream whose elements are are all the
elements of the streams in sequential order.
|
static DoubleStream |
concatAndAutoClose(DoubleStream... streams) |
static IntStream |
concatAndAutoClose(IntStream... streams) |
static LongStream |
concatAndAutoClose(LongStream... streams) |
static <T> Stream<T> |
concatAndAutoClose(Stream<T>... streams)
Creates a lazily concatenated Stream whose elements are are all the
elements of the streams in sequential order.
|
@SafeVarargs public static <T> Stream<T> concatAndAutoClose(Stream<T>... streams)
Streams are processed one at at time. When one is exhausted, a new one will start. Parallelism is only supported within the individual streams provided.
N.B. a stream's close method may be called even through that stream never produced any output, if a preceding stream threw an Exception.
N.B. an UnsupportedOperationException will be thrown if the concatenated
stream's BaseStream.iterator()
or BaseStream.spliterator()
methods are called, because they could
potentially violate the resulting Stream's AutoClose property.
N.B. Use caution when constructing streams from repeated concatenation.
Accessing an element of a deeply concatenated stream can result in deep
call chains, or even StackOverflowException
.
T
- The type of stream elementsstreams
- to concatenateUnsupportedOperationException
- if the concatenated stream's BaseStream.iterator()
or BaseStream.spliterator()
methods are called, because they could
potentially violate the resulting Stream's AutoClose property.@SafeVarargs public static IntStream concatAndAutoClose(IntStream... streams)
@SafeVarargs public static LongStream concatAndAutoClose(LongStream... streams)
@SafeVarargs public static DoubleStream concatAndAutoClose(DoubleStream... streams)
@SafeVarargs public static <T> Stream<T> concat(Stream<T>... streams)
Streams are processed one at at time. When one is exhausted, a new one will start. Parallelism is only supported within the individual streams provided.
N.B. Use caution when constructing streams from repeated concatenation.
Accessing an element of a deeply concatenated stream can result in deep
call chains, or even StackOverflowException
.
T
- The type of stream elementsstreams
- to concatenateCopyright © 2016 Speedment, Inc.. All rights reserved.