Package org.n52.janmayen.stream
Class Streams
java.lang.Object
org.n52.janmayen.stream.Streams
Utility functions for
Stream.-
Method Summary
Modifier and TypeMethodDescriptionstatic IntStreamreverseRange(int from, int to) Returns a sequential reverse-orderedIntStreamfromfrom(inclusive) toto(exclusive) by an incremental step of1.static IntStreamreverseRangeClosed(int from, int to) Returns a sequential reverse-orderedIntStreamfromfrom(inclusive) toto(inclusive) by an incremental step of1.static DoubleStreamreverseStream(double[] array) Returns a reversed stream of the array values.static DoubleStreamreverseStream(double[] array, int startInclusive, int endInclusive) Returns a reversed stream of the array values.static IntStreamreverseStream(int[] array) Returns a reversed stream of the array values.static IntStreamreverseStream(int[] array, int startInclusive, int endInclusive) Returns a reversed stream of the array values.static LongStreamreverseStream(long[] array) Returns a reversed stream of the array values.static LongStreamreverseStream(long[] array, int startInclusive, int endInclusive) Returns a reversed stream of the array values.static <T> Stream<T> reverseStream(T[] array) Returns a reversed stream of the array values.static <T> Stream<T> reverseStream(T[] array, int startInclusive, int endInclusive) Returns a reversed stream of the array values.static DoubleStreamstream(double[] array) Factory function for creating aStreamfrom an array.static IntStreamstream(int[] array) Factory function for creating aStreamfrom an array.static LongStreamstream(long[] array) Factory function for creating aStreamfrom an array.static <T> Stream<T> Factory function for creating aStreamfrom anIterable.static <T> Stream<T> stream(Collection<T> collection) Factory function for creating aStreamfrom aCollection.static <T> Stream<T> stream(Enumeration<T> enumeration) Factory function for creating aStreamfrom anEnumeration.static <T> Stream<T> Factory function for creating aStreamfrom anIterator.static <T> Stream<T> stream(T[] array) Factory function for creating aStreamfrom an array.static <T> BinaryOperator<T> Creates aBinaryOperatorthat throws anIllegalStateExceptionif invoked.static <T> BinaryOperator<T> throwingMerger(BiFunction<T, T, ? extends RuntimeException> exceptionSupplier) Creates aBinaryOperatorthat throws an exception if invoked.static <T> BinaryOperator<T> throwingMerger(Supplier<? extends RuntimeException> exceptionSupplier) Creates aBinaryOperatorthat throws an exception if invoked.
-
Method Details
-
reverseRangeClosed
Returns a sequential reverse-orderedIntStreamfromfrom(inclusive) toto(inclusive) by an incremental step of1.- Parameters:
from- the inclusive lower boundto- the inclusive upper bound- Returns:
- the reverse range
- See Also:
-
reverseRange
Returns a sequential reverse-orderedIntStreamfromfrom(inclusive) toto(exclusive) by an incremental step of1.- Parameters:
from- the inclusive lower boundto- the exclusive upper bound- Returns:
- the reverse range
- See Also:
-
reverseStream
Returns a reversed stream of the array values. Note that the index boundaries are given using the original order.- Type Parameters:
T- the element type of the stream- Parameters:
array- the arraystartInclusive- the lowest index (i.e. the last element to return)endInclusive- index immediately past the highest index (i.e. the index after the first returned value- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values. Note that the index boundaries are given using the original order.- Parameters:
array- the arraystartInclusive- the lowest index (i.e. the last element to return)endInclusive- index immediately past the highest index (i.e. the index after the first returned value- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values. Note that the index boundaries are given using the original order.- Parameters:
array- the arraystartInclusive- the lowest index (i.e. the last element to return)endInclusive- index immediately past the highest index (i.e. the index after the first returned value- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values. Note that the index boundaries are given using the original order.- Parameters:
array- the arraystartInclusive- the lowest index (i.e. the last element to return)endInclusive- index immediately past the highest index (i.e. the index after the first returned value- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values.- Type Parameters:
T- the element type of the stream- Parameters:
array- the array- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values.- Parameters:
array- the array- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values.- Parameters:
array- the array- Returns:
- the reversed stream
-
reverseStream
Returns a reversed stream of the array values.- Parameters:
array- the array- Returns:
- the reversed stream
-
stream
Factory function for creating aStreamfrom anEnumeration.- Type Parameters:
T- the element type- Parameters:
enumeration- the enumeration- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom anIterator.- Type Parameters:
T- the element type- Parameters:
iterator- the iterator- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom anIterable.- Type Parameters:
T- the element type- Parameters:
iterable- the iterable- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom an array.- Type Parameters:
T- the element type- Parameters:
array- the array- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom an array.- Parameters:
array- the array- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom an array.- Parameters:
array- the array- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom an array.- Parameters:
array- the array- Returns:
- the stream
-
stream
Factory function for creating aStreamfrom aCollection.- Type Parameters:
T- the element type- Parameters:
collection- the collection- Returns:
- the stream
-
throwingMerger
public static <T> BinaryOperator<T> throwingMerger(Supplier<? extends RuntimeException> exceptionSupplier) Creates aBinaryOperatorthat throws an exception if invoked.- Type Parameters:
T- the operators input and result type- Parameters:
exceptionSupplier- the exception factory- Returns:
- the operator
- See Also:
-
throwingMerger
Creates aBinaryOperatorthat throws anIllegalStateExceptionif invoked.- Type Parameters:
T- the operators input and result type- Returns:
- the operator
- See Also:
-
throwingMerger
public static <T> BinaryOperator<T> throwingMerger(BiFunction<T, T, ? extends RuntimeException> exceptionSupplier) Creates aBinaryOperatorthat throws an exception if invoked.- Type Parameters:
T- the operators input and result type- Parameters:
exceptionSupplier- the exception factory- Returns:
- the operator
- See Also:
-