Stream instances.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Streams.DoubleFunctionWithIndex<R extends @Nullable Object>
An analogue of |
| public static interface | Streams.FunctionWithIndex<T extends @Nullable Object, R extends @Nullable Object>
An analogue of |
| public static interface | Streams.IntFunctionWithIndex<R extends @Nullable Object>
An analogue of |
| public static interface | Streams.LongFunctionWithIndex<R extends @Nullable Object>
An analogue of |
| private abstract static class | Streams.MapWithIndexSpliterator<F extends Spliterator
|
| private static class |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private static void | |
| public static <T extends @Nullable Object> Stream | |
| public static IntStream | |
| public static LongStream | concat(LongStream... streams)
Returns a |
| public static DoubleStream | concat(DoubleStream... streams)
Returns a |
| public static <T> Optional | findLast(Stream<T> stream)
Returns the last element of the specified stream, or |
| public static OptionalInt | findLast(IntStream stream)
Returns the last element of the specified stream, or |
| public static OptionalLong | findLast(LongStream stream)
Returns the last element of the specified stream, or |
| public static OptionalDouble | findLast(DoubleStream stream)
Returns the last element of the specified stream, or |
| public static <A extends @Nullable Object, B extends @Nullable Object> void | forEachPair(Stream<A> streamA, Stream<B> streamB, BiConsumer<? super A, ? super B> consumer)
Invokes |
| public static <T extends @Nullable Object, R extends @Nullable Object> Stream | mapWithIndex(Stream<T> stream, Streams.
Returns a stream consisting of the results of applying the given function to the elements of
|
| public static <R extends @Nullable Object> Stream | mapWithIndex(IntStream stream, Streams.
Returns a stream consisting of the results of applying the given function to the elements of
|
| public static <R extends @Nullable Object> Stream | mapWithIndex(LongStream stream, Streams.
Returns a stream consisting of the results of applying the given function to the elements of
|
| public static <R extends @Nullable Object> Stream | mapWithIndex(DoubleStream stream, Streams.
Returns a stream consisting of the results of applying the given function to the elements of
|
| public static <T extends @Nullable Object> Stream | stream(Iterable<T> iterable)
Returns a sequential |
| public static <T extends @Nullable Object> Stream | stream(Collection<T> collection)
Deprecated
There is no reason to use this; just invoke
Returns collection.stream() directly.
Collection#stream.
|
| public static <T extends @Nullable Object> Stream | |
| public static <T> Stream | |
| public static <T> Stream | |
| public static IntStream | stream(OptionalInt optional)
If a value is present in |
| public static LongStream | stream(OptionalLong optional)
If a value is present in |
| public static DoubleStream | stream(OptionalDouble optional)
If a value is present in |
| public static <A extends @Nullable Object, B extends @Nullable Object, R extends @Nullable Object> Stream | zip(Stream<A> streamA, Stream<B> streamB, BiFunction<? super A, ? super B, R> function)
Returns a stream in which each element is the result of passing the corresponding element of
each of |
| Streams | back to summary |
|---|---|
| private Streams() | |
| closeAll | back to summary |
|---|---|
| private static void closeAll(BaseStream<?, ?>[] toClose) | |
| concat | back to summary |
|---|---|
| public static <T extends @Nullable Object> Stream Returns a This is equivalent to
| |
| concat | back to summary |
|---|---|
| public static IntStream concat(IntStream... streams) Returns an This is equivalent to | |
| concat | back to summary |
|---|---|
| public static LongStream concat(LongStream... streams) Returns a This is equivalent to | |
| concat | back to summary |
|---|---|
| public static DoubleStream concat(DoubleStream... streams) Returns a This is equivalent to | |
| findLast | back to summary |
|---|---|
| public static <T> Optional Returns the last element of the specified stream, or Equivalent to If the stream has nondeterministic order, this has equivalent semantics to
| |
| findLast | back to summary |
|---|---|
| public static OptionalInt findLast(IntStream stream) Returns the last element of the specified stream, or Equivalent to
| |
| findLast | back to summary |
|---|---|
| public static OptionalLong findLast(LongStream stream) Returns the last element of the specified stream, or Equivalent to
| |
| findLast | back to summary |
|---|---|
| public static OptionalDouble findLast(DoubleStream stream) Returns the last element of the specified stream, or Equivalent to
| |
| forEachPair | back to summary |
|---|---|
| public static <A extends @Nullable Object, B extends @Nullable Object> void forEachPair(Stream<A> streamA, Stream<B> streamB, BiConsumer<? super A, ? super B> consumer) Invokes
will print: Warning If either supplied stream is a parallel stream, the same correspondence between elements will be made, but the order in which those pairs of elements are passed to the consumer is not defined. Note that many usages of this method can be replaced with simpler calls to
| |
| mapWithIndex | back to summary |
|---|---|
| public static <T extends @Nullable Object, R extends @Nullable Object> Stream Returns a stream consisting of the results of applying the given function to the elements of
would return The resulting stream is efficiently splittable
if and only if The order of the resulting stream is defined if and only if the order of the original stream was defined. | |
| mapWithIndex | back to summary |
|---|---|
| public static <R extends @Nullable Object> Stream Returns a stream consisting of the results of applying the given function to the elements of
...would return The resulting stream is efficiently splittable
if and only if The order of the resulting stream is defined if and only if the order of the original stream was defined. | |
| mapWithIndex | back to summary |
|---|---|
| public static <R extends @Nullable Object> Stream Returns a stream consisting of the results of applying the given function to the elements of
...would return The resulting stream is efficiently splittable
if and only if The order of the resulting stream is defined if and only if the order of the original stream was defined. | |
| mapWithIndex | back to summary |
|---|---|
| public static <R extends @Nullable Object> Stream Returns a stream consisting of the results of applying the given function to the elements of
...would return The resulting stream is efficiently splittable
if and only if The order of the resulting stream is defined if and only if the order of the original stream was defined. | |
| stream | back to summary |
|---|---|
| public static <T extends @Nullable Object> Stream Returns a sequential | |
| stream | back to summary |
|---|---|
| public static <T extends @Nullable Object> Stream Deprecated There is no reason to use this; just invoke Returns
| |
| stream | back to summary |
|---|---|
| public static <T extends @Nullable Object> Stream Returns a sequential | |
| stream | back to summary |
|---|---|
| public static <T> Stream If a value is present in | |
| stream | back to summary |
|---|---|
| public static <T> Stream If a value is present in Java 9 users: use
| |
| stream | back to summary |
|---|---|
| public static IntStream stream(OptionalInt optional) If a value is present in Java 9 users: use
| |
| stream | back to summary |
|---|---|
| public static LongStream stream(OptionalLong optional) If a value is present in Java 9 users: use
| |
| stream | back to summary |
|---|---|
| public static DoubleStream stream(OptionalDouble optional) If a value is present in Java 9 users: use
| |
| zip | back to summary |
|---|---|
| public static <A extends @Nullable Object, B extends @Nullable Object, R extends @Nullable Object> Stream Returns a stream in which each element is the result of passing the corresponding element of
each of For example:
will return The resulting stream will only be as long as the shorter of the two input streams; if one stream is longer, its extra elements will be ignored. Note that if you are calling Performance note: The resulting stream is not efficiently splittable. This may harm parallel performance.
| |
java.util.function.DoubleFunction also accepting an index.
This interface is only intended for use by callers of mapWithIndex(DoubleStream,
DoubleFunctionWithIndex).
| Modifier and Type | Method and Description |
|---|---|
| public R | apply(double from, long index)
Applies this function to the given argument and its index within a stream. |
| apply | back to summary |
|---|---|
| public R apply(double from, long index) Applies this function to the given argument and its index within a stream.
| |
java.util.function.Function also accepting an index.
This interface is only intended for use by callers of mapWithIndex(Stream,
FunctionWithIndex).
| Modifier and Type | Method and Description |
|---|---|
| public R |
| apply | back to summary |
|---|---|
| public R apply(T from, long index) Applies this function to the given argument and its index within a stream.
| |
java.util.function.IntFunction also accepting an index.
This interface is only intended for use by callers of mapWithIndex(IntStream,
IntFunctionWithIndex).
| Modifier and Type | Method and Description |
|---|---|
| public R | apply(int from, long index)
Applies this function to the given argument and its index within a stream. |
| apply | back to summary |
|---|---|
| public R apply(int from, long index) Applies this function to the given argument and its index within a stream.
| |
java.util.function.LongFunction also accepting an index.
This interface is only intended for use by callers of mapWithIndex(LongStream,
LongFunctionWithIndex).
| Modifier and Type | Method and Description |
|---|---|
| public R | apply(long from, long index)
Applies this function to the given argument and its index within a stream. |
| apply | back to summary |
|---|---|
| public R apply(long from, long index) Applies this function to the given argument and its index within a stream.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final F | |
| pack-priv long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public int | characteristics()
Implements java. |
| pack-priv abstract S | |
| public long | estimateSize()
Implements java. forEachRemaining traversal, or returns Long#MAX_VALUE if infinite, unknown, or too expensive to compute.
|
| public S | trySplit()
Implements java. |
| fromSpliterator | back to summary |
|---|---|
| pack-priv final F fromSpliterator | |
| index | back to summary |
|---|---|
| pack-priv long index | |
| MapWithIndexSpliterator | back to summary |
|---|---|
| pack-priv MapWithIndexSpliterator(F fromSpliterator, long index) | |
| characteristics | back to summary |
|---|---|
| public int characteristics() Implements java. Doc from java. Returns a set of characteristics of this Spliterator and its
elements. The result is represented as ORed values from If a Spliterator reports an inconsistent set of characteristics (either those returned from a single invocation or across multiple invocations), no guarantees can be made about any computation using this Spliterator.
| |
| createSplit | back to summary |
|---|---|
| pack-priv abstract S createSplit(F from, long i) | |
| estimateSize | back to summary |
|---|---|
| public long estimateSize() Implements java. Doc from java. Returns an estimate of the number of elements that would be
encountered by a If this Spliterator is
| |
| trySplit | back to summary |
|---|---|
| public S trySplit() Implements java. Doc from java. If this spliterator can be partitioned, returns a Spliterator covering elements, that will, upon return from this method, not be covered by this Spliterator. If this Spliterator is Unless this Spliterator covers an infinite number of elements,
repeated calls to
This method may return
| |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| a | back to summary |
|---|---|
| pack-priv final A a
| |
| b | back to summary |
|---|---|
| pack-priv final B b
| |
| TemporaryPair | back to summary |
|---|---|
| pack-priv TemporaryPair(A a, B b) | |