Class StreamUtils

java.lang.Object
it.tidalwave.util.StreamUtils

public final class StreamUtils extends Object
A collection of operations on Streams.
Since:
3.2-ALPHA-12
Author:
Fabrizio Giudici
Status: draft API
  • 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.
      Type Parameters:
      A - the type of elements of the first Stream
      B - the type of elements of the second Stream
      Parameters:
      streamA - the first Stream
      streamB - the second Stream
      Returns:
      the zipped Stream of Pairs
      Since:
      3.2-ALPHA-20
      See Also:
    • zip

      @Nonnull public static <A, B, R> Stream<R> zip(@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 first Stream
      B - the type of elements of the second Stream
      R - the type of elements of the zipped Stream
      Parameters:
      streamA - the first Stream
      streamB - the second Stream
      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 a Stream of random LocalDateTimes, in the given range.
      Parameters:
      seed - the random seed
      from - the lower bound of the range (included)
      to - the upper bound of the range (excluded)
      Returns:
      the stream
      Since:
      3.2-ALPHA-19