Modifier and Type | Method and Description |
---|---|
static <T> Iterable<T> |
asIterable(Stream<T> stream)
|
static <T> Stream<T> |
streamEnumeration(Enumeration<T> enumeration)
Converts an
Enumeration to a Stream . |
static <T> Stream<T> |
streamIterable(Iterable<T> iterable)
Converts an
Iterable to a Stream . |
static <T> Stream<T> |
streamOptional(Optional<T> optional)
Converts an
Optional to a single-element or empty Stream . |
@Nonnull public static <T> Stream<T> streamEnumeration(@Nonnull Enumeration<T> enumeration)
Enumeration
to a Stream
.T
- the type of element in the Enumeration
enumeration
- the Enumeration
to streamStream
over the provided enumeration
NullPointerException
- if the provided enumeration
is null
@Nonnull public static <T> Stream<T> streamIterable(@Nonnull Iterable<T> iterable)
Iterable
to a Stream
.T
- the type of element in the Iterable
iterable
- the Iterable
to streamStream
over the provided iterable
NullPointerException
- if the provided iterable
is null
@Nonnull public static <T> Stream<T> streamOptional(@Nonnull Optional<T> optional)
Optional
to a single-element or empty Stream
.T
- the type of element in the Optional
optional
- the Optional
to streamStream
if the Optional
is present; otherwise an empty Stream
NullPointerException
- if the provided optional
is null
Copyright © 2022 Atlassian. All rights reserved.