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 anEnumerationto aStream.static <T> Stream<T>streamIterable(Iterable<T> iterable) Converts anIterableto aStream.static <T> Stream<T>streamOptional(Optional<T> optional) Converts anOptionalto a single-element or emptyStream.
-
Method Details
-
asIterable
-
streamEnumeration
Converts anEnumerationto aStream.- Type Parameters:
T- the type of element in theEnumeration- Parameters:
enumeration- theEnumerationto stream- Returns:
- a
Streamover the providedenumeration - Throws:
NullPointerException- if the providedenumerationisnull- Since:
- 4.9
-
streamIterable
Converts anIterableto aStream.- Type Parameters:
T- the type of element in theIterable- Parameters:
iterable- theIterableto stream- Returns:
- a
Streamover the providediterable - Throws:
NullPointerException- if the providediterableisnull
-
streamOptional
Converts anOptionalto a single-element or emptyStream.- Type Parameters:
T- the type of element in theOptional- Parameters:
optional- theOptionalto stream- Returns:
- a single-element
Streamif theOptionalis present; otherwise an emptyStream - Throws:
NullPointerException- if the providedoptionalisnull
-