Package org.meeuw.math
Class Streams
- java.lang.Object
-
- org.meeuw.math.Streams
-
public final class Streams extends Object
- Since:
- 0.4
- Author:
- Michiel Meeuwissen
-
-
Field Summary
Fields Modifier and Type Field Description static int
MAX_THREADS
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Stream<BigInteger>
bigIntegerStream(boolean includeNegatives)
static Stream<BigInteger>
bigIntegerStream(BigInteger start, boolean includeNegatives)
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.static <E1,E2,F>
Stream<F>diagonalStream(Supplier<Stream<E1>> stream1, Supplier<Stream<E2>> stream2, BiFunction<E1,E2,F> combiner)
Defaulting version ofdiagonalStream(Function, Supplier, BiFunction)
.static Stream<BigInteger>
reverseBigIntegerStream(BigInteger start, boolean includeNegatives)
static <E> Stream<E>
reverseStream(Stream<E> stream, long start)
Reverses a stream.
-
-
-
Field Detail
-
MAX_THREADS
public static final int MAX_THREADS
- See Also:
- Constant Field Values
-
-
Method Detail
-
bigIntegerStream
public static Stream<BigInteger> bigIntegerStream(boolean includeNegatives)
-
bigIntegerStream
public static Stream<BigInteger> bigIntegerStream(BigInteger start, 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 firststream2
- A supplier to create a new streamcombiner
- A bifunction to combine the two values supplied by the two stream to one new value
-
diagonalStream
public static <E1,E2,F> Stream<F> diagonalStream(Supplier<Stream<E1>> stream1, Supplier<Stream<E2>> stream2, BiFunction<E1,E2,F> combiner)
Defaulting version ofdiagonalStream(Function, Supplier, BiFunction)
.- Parameters:
stream1
- The first stream, which will be reversed usingreverseStream(Stream, long)
-
-