Package it.tidalwave.util
Class StreamUtils
java.lang.Object
it.tidalwave.util.StreamUtils
A collection of operations on
Stream
s.- Since:
- 3.2-ALPHA-12
- Author:
- Fabrizio Giudici
- Status: draft API
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Stream
<LocalDateTime> randomLocalDateTimeStream
(long seed, LocalDateTime from, LocalDateTime to) Returns aStream
of randomLocalDateTime
s, in the given range.Zips two streams.static <A,
B, R> Stream <R> zip
(Stream<? extends A> streamA, Stream<? extends B> streamB, BiFunction<? super A, ? super B, ? extends R> zipper) Zips two streams.
-
Constructor Details
-
StreamUtils
public StreamUtils()
-
-
Method Details
-
zip
@Nonnull public static <A,B> Stream<Pair<A,B>> zip(@Nonnull Stream<? extends A> streamA, @Nonnull Stream<? extends B> streamB) Zips two streams. -
zip
@Nonnull public static <A,B, Stream<R> zipR> (@Nonnull Stream<? extends A> streamA, @Nonnull Stream<? extends B> streamB, @Nonnull BiFunction<? super A, ? super B, ? extends R> zipper) Zips two streams.- Type Parameters:
A
- the type of elements of the firstStream
B
- the type of elements of the secondStream
R
- the type of elements of the zippedStream
- Parameters:
streamA
- the firstStream
streamB
- the secondStream
zipper
- the zipping function- Returns:
- the zipped
Stream
- Since:
- 3.2-ALPHA-12
- See Also:
-
randomLocalDateTimeStream
@Nonnull public static Stream<LocalDateTime> randomLocalDateTimeStream(long seed, @Nonnull LocalDateTime from, @Nonnull LocalDateTime to) Returns aStream
of randomLocalDateTime
s, in the given range.- Parameters:
seed
- the random seedfrom
- the lower bound of the range (included)to
- the upper bound of the range (excluded)- Returns:
- the stream
- Since:
- 3.2-ALPHA-19
-