Class Streams


  • public final class Streams
    extends Object
    Since:
    0.4
    Author:
    Michiel Meeuwissen
    • Method Detail

      • bigIntegerStream

        public static Stream<BigInteger> bigIntegerStream​(boolean includeNegatives)
      • reverseBigIntegerStream

        public static Stream<BigInteger> reverseBigIntegerStream​(BigInteger start,
                                                                 boolean includeNegatives)
      • diagonalStream

        public static <E1,​E2,​F> Stream<F> diagonalStream​(Function<Long,​Stream<E1>> stream1,
                                                                     Supplier<Stream<E2>> stream2,
                                                                     BiFunction<E1,​E2,​F> combiner)
        Contains the logic to combine two streams. They are found by tracing diagonals in the plain spanned by the two stream.
        Parameters:
        stream1 - A function to create new stream, which returns all values from the nth value down to the first
        stream2 - A supplier to create a new stream
        combiner - A bifunction to combine the two values supplied by the two stream to one new value
      • reverseStream

        public static <E> Stream<E> reverseStream​(Stream<E> stream,
                                                  long start)
        Reverses a stream. This happens by collecting it to al list first, and then stream that backwards.*