Class Streams
- java.lang.Object
-
- uk.gov.gchq.gaffer.commonutil.stream.Streams
-
public final class Streams extends Object
Utility class to help with the usage of the Java 8 Streams API in Gaffer.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> Stream<List<T>>
toBatches(Iterable<T> iterable, int size)
static <T> Stream<T>
toParallelStream(Iterable<T> iterable)
static <T> Stream<T>
toParallelStream(Iterator<T> iterator)
static <T> Stream<T>
toParallelStream(T... array)
Convert an array to aStream
.static <T> Stream<T>
toStream(Iterable<T> iterable)
static <T> Stream<T>
toStream(Iterator<T> iterator)
static <T> Stream<T>
toStream(T... array)
Convert an array to aStream
.
-
-
-
Method Detail
-
toStream
public static <T> Stream<T> toStream(Iterable<T> iterable)
- Type Parameters:
T
- the type of object stored in the iterable- Parameters:
iterable
- the input iterable- Returns:
- a stream containing the contents of the iterable
-
toStream
public static <T> Stream<T> toStream(T... array)
Convert an array to aStream
.- Type Parameters:
T
- the type of object stored in the array- Parameters:
array
- the input array- Returns:
- a stream containing the contents of the array
-
toStream
public static <T> Stream<T> toStream(Iterator<T> iterator)
- Type Parameters:
T
- the type of object stored in the iterator- Parameters:
iterator
- the input iterator- Returns:
- a stream containing the contents of the iterator
-
toParallelStream
public static <T> Stream<T> toParallelStream(Iterable<T> iterable)
- Type Parameters:
T
- the type of object stored in the iterable- Parameters:
iterable
- the input iterable- Returns:
- a stream containing the contents of the iterable
-
toParallelStream
public static <T> Stream<T> toParallelStream(Iterator<T> iterator)
- Type Parameters:
T
- the type of object stored in the iterator- Parameters:
iterator
- the input iterator- Returns:
- a stream containing the contents of the iterator
-
toParallelStream
public static <T> Stream<T> toParallelStream(T... array)
Convert an array to aStream
.- Type Parameters:
T
- the type of object stored in the array- Parameters:
array
- the input array- Returns:
- a stream containing the contents of the array
-
-