Package uk.co.terminological.rjava.utils
Class RStreams
java.lang.Object
uk.co.terminological.rjava.utils.RStreams
The Class Java8Streams can be statically imported and allows any type to be flatMapped.
e.g. streamOfMaybeListsContainingNullValues.flatMap(l -> maybe(l.getOptionalValue()));
- Version:
- $Id: $Id
- Author:
- vp22681
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
static interface
static class
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,
R> Function<T, RStreams.Exceptional<R>> deferError
(RStreams.ExceptionalFunction<T, R> fn) deferError.static <T> Stream<T>
Create a stream from a potentially null iterablestatic <T> Stream<T>
maybe
(Collection<T> list) Create a stream from a potentially null collectionstatic <T> Stream<T>
Create a stream from a potentially null iteratorstatic <T> Stream<T>
Create a stream from a potentially null optionalstatic <T> Stream<T>
Create a stream from a potentially null streamstatic <T> Stream<T>
maybe
(T... t) Create a stream from a potentially null singleton or arraystatic <T> Stream<T>
maybe
(RPrimitive t) Create a stream from a potentially null or NA valued RPrimitivestatic <U extends RPrimitive,
T>
Stream<T>Create a stream from a potentially null or NA valued RVector
-
Constructor Details
-
RStreams
public RStreams()
-
-
Method Details
-
maybe
Create a stream from a potentially null singleton or array- Type Parameters:
T
- any type- Parameters:
t
- a set of values- Returns:
- a stream
-
maybe
Create a stream from a potentially null collection- Type Parameters:
T
- any type- Parameters:
list
- a collection of values- Returns:
- a stream
-
maybe
Create a stream from a potentially null stream- Type Parameters:
T
- any type- Parameters:
stream
- a stream- Returns:
- a stream
-
maybe
Create a stream from a potentially null optional- Type Parameters:
T
- any type- Parameters:
t
- an optional value- Returns:
- a stream
-
maybe
Create a stream from a potentially null iterable- Type Parameters:
T
- any type- Parameters:
iter
- an iterable of values- Returns:
- a stream
-
maybe
Create a stream from a potentially null iterator- Type Parameters:
T
- any type- Parameters:
iter
- an iterator- Returns:
- a stream
-
maybe
Create a stream from a potentially null or NA valued RPrimitive- Type Parameters:
T
- any type- Parameters:
t
- an RPrimitive- Returns:
- a stream of the underlying java object omitting NA values
-
maybe
Create a stream from a potentially null or NA valued RVector- Type Parameters:
T
- any typeU
- an RPrimitive- Parameters:
t
- an RVector of type U- Returns:
- a stream of the underlying java object omitting NA values
-
deferError
public static <T,R> Function<T,RStreams.Exceptional<R>> deferError(RStreams.ExceptionalFunction<T, R> fn) deferError.
- Type Parameters:
T
- a T classR
- a R class- Parameters:
fn
- aRStreams.ExceptionalFunction
object- Returns:
- a
Function
object
-