T - public class StreamableTValue<T> extends java.lang.Object implements StreamableT<T>
| Modifier and Type | Method and Description |
|---|---|
<R> StreamableTValue<R> |
empty() |
static <T> StreamableTValue<T> |
emptyOptional() |
boolean |
equals(java.lang.Object o) |
StreamableTValue<T> |
filter(java.util.function.Predicate<? super T> test)
Filter the wrapped Streamable
|
<B> StreamableTValue<B> |
flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends B>> f) |
<B> StreamableTValue<B> |
flatMapT(java.util.function.Function<? super T,StreamableTValue<? extends B>> f)
Flat Map the wrapped Streamable
|
static <A> StreamableTValue<A> |
fromAnyM(AnyMValue<A> anyM)
|
static <A> StreamableTValue<A> |
fromStream(AnyMValue<java.util.stream.Stream<A>> monads)
Create a StreamableT from an AnyM that wraps a monad containing a Stream
|
static <A,V extends MonadicValue<Streamable<A>>> |
fromValue(V monadicValue) |
Streamable<T> |
get() |
int |
hashCode() |
boolean |
isSeqPresent() |
boolean |
isStreamablePresent() |
java.util.Iterator<T> |
iterator() |
static <U,R> java.util.function.Function<StreamableTValue<U>,StreamableTValue<R>> |
lift(java.util.function.Function<? super U,? extends R> fn)
Lift a function into one that accepts and returns an StreamableT
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
static <U1,U2,R> java.util.function.BiFunction<StreamableTValue<U1>,StreamableTValue<U2>,StreamableTValue<R>> |
lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
Lift a BiFunction into one that accepts and returns StreamableTs
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
<B> StreamableTValue<B> |
map(java.util.function.Function<? super T,? extends B> f)
Map the wrapped Streamable
|
AnyM<? extends CyclopsCollectable<T>> |
nestedCollectables() |
AnyM<? extends IterableFoldable<T>> |
nestedFoldables() |
static <A> StreamableTValue<A> |
of(AnyMValue<Streamable<A>> monads)
Construct an StreamableT from an AnyM that wraps a monad containing Streamables
|
static <A> StreamableTValue<A> |
of(Streamable<A> monads) |
StreamableTValue<T> |
peek(java.util.function.Consumer<? super T> peek)
Peek at the current value of the Streamable
|
ReactiveSeq<T> |
stream() |
java.lang.String |
toString() |
AnyM<? extends Traversable<T>> |
transformerStream() |
<T> StreamableTValue<T> |
unit(T unit) |
<T> StreamableTValue<T> |
unitAnyM(AnyM<Traversable<T>> traversable) |
<U> StreamableTValue<U> |
unitIterator(java.util.Iterator<U> u) |
AnyM<Streamable<T>> |
unwrap() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitbind, cast, combine, cycle, cycle, cycleUntil, cycleWhile, distinct, dropRight, dropUntil, dropWhile, emptyStreamable, filterNot, fromAnyM, fromAnyMSeq, fromAnyMValue, fromFuture, fromIterable, fromIterableValue, fromOptional, fromPublisher, fromStream, fromStream, grouped, grouped, grouped, grouped, groupedStatefullyWhile, groupedUntil, groupedUntil, groupedWhile, groupedWhile, intersperse, limit, limitLast, limitUntil, limitWhile, notNull, of, ofType, onEmpty, onEmptyGet, onEmptyThrow, patternMatch, reverse, scanLeft, scanLeft, scanRight, scanRight, shuffle, shuffle, skip, skipLast, skipUntil, skipWhile, slice, sliding, sliding, sorted, sorted, sorted, takeRight, takeUntil, takeWhile, trampoline, zip, zip, zip, zip, zip, zip, zip3, zip4, zipWithIndexfutureOperations, lazyOperations, subscribeseq, toCompletableFuture, toDequeX, toEvalAlways, toEvalLater, toEvalNow, toFutureStream, toFutureStream, toFutureW, toIor, toIorSecondary, toListX, toMapX, toMaybe, toOptional, toPBagX, toPMapX, toPOrderedSetX, toPQueueX, toPSetX, toPStackX, toPVectorX, toQueueX, toSetX, toSimpleReact, toSimpleReact, toSortedSetX, toStreamable, toTry, toValue, toValueMap, toValueSet, toXor, toXorSecondarytraversablefixedDelay, onePer, xPerfutureStream, getStreamable, isEmpty, jdkStream, reactiveSeq, reveresedJDKStream, reveresedStreamendsWith, endsWithIterable, findFirst, firstValue, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, headAndTail, join, join, join, mapReduce, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, visitallMatch, anyMatch, collect, collect, listT, noneMatch, setT, streamableT, streamT, toListOfLists, toNestedListX, toNestedSetX, toSetOfSetspublic AnyM<Streamable<T>> unwrap()
unwrap in interface StreamableT<T>public boolean isSeqPresent()
isSeqPresent in interface TransformerSeq<T>public StreamableTValue<T> peek(java.util.function.Consumer<? super T> peek)
StreamableT.of(AnyM.fromStream(Streamable.of(10))
.peek(System.out::println);
//prints 10
public StreamableTValue<T> filter(java.util.function.Predicate<? super T> test)
StreamableT.of(AnyM.fromStream(Streamable.of(10,11))
.filter(t->t!=10);
//StreamableT<AnyM<Stream<Streamable[11]>>>
filter in interface StreamableT<T>filter in interface Filterable<T>filter in interface FilterableFunctor<T>test - Predicate to filter the wrapped Streamablepublic <B> StreamableTValue<B> map(java.util.function.Function<? super T,? extends B> f)
StreamableT.of(AnyM.fromStream(Streamable.of(10))
.map(t->t=t+1);
//StreamableT<AnyM<Stream<Streamable[11]>>>
map in interface StreamableT<T>map in interface FilterableFunctor<T>map in interface Functor<T>f - Mapping function for the wrapped Streamablepublic <B> StreamableTValue<B> flatMapT(java.util.function.Function<? super T,StreamableTValue<? extends B>> f)
StreamableT.of(AnyM.fromStream(Arrays.asStreamable(10))
.flatMap(t->Streamable.of(2));
//StreamableT<AnyM<Stream<Streamable.[2]>>>
f - FlatMap functionpublic <B> StreamableTValue<B> flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends B>> f)
flatMap in interface StreamableT<T>public static <U,R> java.util.function.Function<StreamableTValue<U>,StreamableTValue<R>> lift(java.util.function.Function<? super U,? extends R> fn)
Function<Integer,Integer> add2 = i -> i+2;
Function<StreamableT<Integer>, StreamableT<Integer>> optTAdd2 = StreamableT.lift(add2);
Stream<Integer> nums = Stream.of(1,2);
AnyM<Stream<Integer>> stream = AnyM.ofMonad(Optional.of(nums));
List<Integer> results = optTAdd2.apply(StreamableT.fromStream(stream))
.unwrap()
.<Optional<Streamable<Integer>>>unwrap()
.get()
.collect(Collectors.toList());
//Streamable.of(3,4);
lift in interface StreamableT<T>fn - Function to enhance with functionality from Streamable and another monad typepublic static <U1,U2,R> java.util.function.BiFunction<StreamableTValue<U1>,StreamableTValue<U2>,StreamableTValue<R>> lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
BiFunction<Integer,Integer,Integer> add = (a,b) -> a+b;
BiFunction<StreamableT<Integer>,StreamableT<Integer>, StreamableT<Integer>> optTAdd2 = StreamableT.lift2(add);
Streamable<Integer> threeValues = Streamable.of(1,2,3);
AnyM<Integer> stream = AnyM.ofMonad(threeValues);
AnyM<Streamable<Integer>> streamOpt = stream.map(Streamable::of);
CompletableFuture<Streamable<Integer>> two = CompletableFuture.completedFuture(Streamable.of(2));
AnyM<Streamable<Integer>> future= AnyM.fromCompletableFuture(two);
List<Integer> results = optTAdd2.apply(StreamableT.of(streamOpt),StreamableT.of(future))
.unwrap()
.<Stream<Streamable<Integer>>>unwrap()
.flatMap(i->i.sequenceM())
.collect(Collectors.toList());
//Streamable.of(3,4);
lift2 in interface StreamableT<T>fn - BiFunction to enhance with functionality from Streamable and another monad typepublic static <A> StreamableTValue<A> fromAnyM(AnyMValue<A> anyM)
anyM - AnyM that doesn't contain a monad wrapping an Streamablepublic static <A> StreamableTValue<A> of(AnyMValue<Streamable<A>> monads)
monads - AnyM that contains a monad wrapping an Streamablepublic static <A> StreamableTValue<A> of(Streamable<A> monads)
public static <A> StreamableTValue<A> fromStream(AnyMValue<java.util.stream.Stream<A>> monads)
monads - public static <A,V extends MonadicValue<Streamable<A>>> StreamableTValue<A> fromValue(V monadicValue)
fromValue in interface StreamableT<T>public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Iterator<T> iterator()
public <U> StreamableTValue<U> unitIterator(java.util.Iterator<U> u)
unitIterator in interface StreamableT<T>public <T> StreamableTValue<T> unit(T unit)
unit in interface StreamableT<T>public ReactiveSeq<T> stream()
stream in interface FoldableTransformerSeq<T>stream in interface TransformerSeq<T>stream in interface NestedFoldable<T>stream in interface Sequential<T>stream in interface ConvertableSequence<T>stream in interface ToStream<T>stream in interface Traversable<T>public <R> StreamableTValue<R> empty()
empty in interface StreamableT<T>public static <T> StreamableTValue<T> emptyOptional()
emptyOptional in interface StreamableT<T>public boolean isStreamablePresent()
public Streamable<T> get()
public AnyM<? extends IterableFoldable<T>> nestedFoldables()
nestedFoldables in interface NestedFoldable<T>public AnyM<? extends CyclopsCollectable<T>> nestedCollectables()
nestedCollectables in interface NestedCollectable<T>public <T> StreamableTValue<T> unitAnyM(AnyM<Traversable<T>> traversable)
unitAnyM in interface TransformerSeq<T>public AnyM<? extends Traversable<T>> transformerStream()
transformerStream in interface TransformerSeq<T>public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Object