Package org.n52.janmayen.stream
Class Streams
- java.lang.Object
-
- org.n52.janmayen.stream.Streams
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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>stream(Iterable<T> iterable)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>stream(Iterator<T> iterator)Factory function for creating aStreamfrom anIterator.static <T> Stream<T>stream(T[] array)Factory function for creating aStreamfrom an array.static <T> BinaryOperator<T>throwingMerger()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 Detail
-
reverseRangeClosed
public static IntStream reverseRangeClosed(int from, int to)
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:
IntStream.range(int, int)
-
reverseRange
public static IntStream reverseRange(int from, int to)
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:
IntStream.range(int, int)
-
reverseStream
public static <T> Stream<T> reverseStream(T[] array, int startInclusive, int endInclusive)
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
public static LongStream reverseStream(long[] array, int startInclusive, int endInclusive)
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
public static IntStream reverseStream(int[] array, int startInclusive, int endInclusive)
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
public static DoubleStream reverseStream(double[] array, int startInclusive, int endInclusive)
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
public static <T> Stream<T> reverseStream(T[] array)
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
public static LongStream reverseStream(long[] array)
Returns a reversed stream of the array values.- Parameters:
array- the array- Returns:
- the reversed stream
-
reverseStream
public static IntStream reverseStream(int[] array)
Returns a reversed stream of the array values.- Parameters:
array- the array- Returns:
- the reversed stream
-
reverseStream
public static DoubleStream reverseStream(double[] array)
Returns a reversed stream of the array values.- Parameters:
array- the array- Returns:
- the reversed stream
-
stream
public static <T> Stream<T> stream(Enumeration<T> enumeration)
Factory function for creating aStreamfrom anEnumeration.- Type Parameters:
T- the element type- Parameters:
enumeration- the enumeration- Returns:
- the stream
-
stream
public static <T> Stream<T> stream(Iterator<T> iterator)
Factory function for creating aStreamfrom anIterator.- Type Parameters:
T- the element type- Parameters:
iterator- the iterator- Returns:
- the stream
-
stream
public static <T> Stream<T> stream(Iterable<T> iterable)
Factory function for creating aStreamfrom anIterable.- Type Parameters:
T- the element type- Parameters:
iterable- the iterable- Returns:
- the stream
-
stream
public static <T> Stream<T> stream(T[] array)
Factory function for creating aStreamfrom an array.- Type Parameters:
T- the element type- Parameters:
array- the array- Returns:
- the stream
-
stream
public static IntStream stream(int[] array)
Factory function for creating aStreamfrom an array.- Parameters:
array- the array- Returns:
- the stream
-
stream
public static LongStream stream(long[] array)
Factory function for creating aStreamfrom an array.- Parameters:
array- the array- Returns:
- the stream
-
stream
public static DoubleStream stream(double[] array)
Factory function for creating aStreamfrom an array.- Parameters:
array- the array- Returns:
- the stream
-
stream
public static <T> Stream<T> stream(Collection<T> collection)
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:
Collectors.toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator),Collectors.toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, java.util.function.Supplier),Collectors.toConcurrentMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator),Collectors.toConcurrentMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, java.util.function.Supplier)
-
throwingMerger
public static <T> BinaryOperator<T> throwingMerger()
Creates aBinaryOperatorthat throws anIllegalStateExceptionif invoked.- Type Parameters:
T- the operators input and result type- Returns:
- the operator
- See Also:
Collectors.toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator),Collectors.toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, java.util.function.Supplier),Collectors.toConcurrentMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator),Collectors.toConcurrentMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, java.util.function.Supplier)
-
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:
Collectors.toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator),Collectors.toMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, java.util.function.Supplier),Collectors.toConcurrentMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator),Collectors.toConcurrentMap(java.util.function.Function, java.util.function.Function, java.util.function.BinaryOperator, java.util.function.Supplier)
-
-