Package com.atlassian.bitbucket.util
Class MoreStreams
java.lang.Object
com.atlassian.bitbucket.util.MoreStreams
Additional utilities for creating
streams
.-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Iterable<T>
asIterable
(Stream<T> stream) static <T> Stream<T>
streamEnumeration
(Enumeration<T> enumeration) Converts anEnumeration
to aStream
.static <T> Stream<T>
streamIterable
(Iterable<T> iterable) Converts anIterable
to aStream
.static <T> Stream<T>
streamOptional
(Optional<T> optional) Converts anOptional
to a single-element or emptyStream
.
-
Method Details
-
asIterable
-
streamEnumeration
Converts anEnumeration
to aStream
.- Type Parameters:
T
- the type of element in theEnumeration
- Parameters:
enumeration
- theEnumeration
to stream- Returns:
- a
Stream
over the providedenumeration
- Throws:
NullPointerException
- if the providedenumeration
isnull
- Since:
- 4.9
-
streamIterable
Converts anIterable
to aStream
.- Type Parameters:
T
- the type of element in theIterable
- Parameters:
iterable
- theIterable
to stream- Returns:
- a
Stream
over the providediterable
- Throws:
NullPointerException
- if the providediterable
isnull
-
streamOptional
Converts anOptional
to a single-element or emptyStream
.- Type Parameters:
T
- the type of element in theOptional
- Parameters:
optional
- theOptional
to stream- Returns:
- a single-element
Stream
if theOptional
is present; otherwise an emptyStream
- Throws:
NullPointerException
- if the providedoptional
isnull
-