public abstract class StreamUtils
extends java.lang.Object
StreamUtils
class is a abstract utility class for working with Streams
.Stream
Constructor and Description |
---|
StreamUtils() |
Modifier and Type | Method and Description |
---|---|
static <T> java.util.stream.Stream<T> |
concat(java.util.stream.Stream<T>... streams)
Concatenates an array of
Streams into a single, continuous Stream . |
static long |
nullSafeCount(java.util.stream.Stream<?> stream)
Null-safe utility method used to return a
count of the number of elements
in the given Stream . |
static boolean |
nullSafeIsEmpty(java.util.stream.Stream<?> stream)
Null-safe utility method used to determine whether the given
Stream is empty. |
static <T> java.util.stream.Stream<T> |
nullSafeStream(java.util.stream.Stream<T> stream)
Utility method used to guard against null
Streams . |
public static <T> java.util.stream.Stream<T> concat(java.util.stream.Stream<T>... streams)
Streams
into a single, continuous Stream
.T
- type
of elements in the Streams
.streams
- array of Streams
to concatenate.Streams
as a single, continuous Stream
.Stream
public static long nullSafeCount(java.util.stream.Stream<?> stream)
count
of the number of elements
in the given Stream
.stream
- Stream
of elements
to count.count
of the number of elements
in the Stream
.Stream.count()
,
nullSafeStream(Stream)
public static boolean nullSafeIsEmpty(java.util.stream.Stream<?> stream)
Stream
is empty.stream
- Stream
to evalute.Stream
is empty.Stream
,
nullSafeCount(Stream)
public static <T> java.util.stream.Stream<T> nullSafeStream(java.util.stream.Stream<T> stream)
Streams
.T
- type
of the elements
in the Stream
.stream
- Stream
to evaluate.Stream
if not null or an empty
Stream
.Stream