T - public class ListTValue<T> extends java.lang.Object implements ListT<T>, TransformerSeq<T>, org.reactivestreams.Publisher<T>
| Modifier and Type | Method and Description |
|---|---|
<R> ListTValue<R> |
empty() |
static <T> ListTValue<T> |
emptyOptional() |
ListTValue<T> |
filter(java.util.function.Predicate<? super T> test)
Filter the wrapped List
|
<B> ListTValue<B> |
flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends B>> f) |
<B> ListTValue<B> |
flatMapT(java.util.function.Function<? super T,ListTValue<B>> f)
Flat Map the wrapped List
|
static <A> ListTValue<A> |
fromAnyM(AnyMValue<A> anyM)
|
static <A> ListTValue<A> |
fromStream(AnyMValue<? extends java.util.stream.Stream<A>> monads)
Create a ListT from an AnyM that wraps a monad containing a Stream
|
static <A,V extends MonadicValue<? extends java.util.List<A>>> |
fromValue(V monadicValue) |
java.util.List<T> |
get() |
boolean |
isListPresent() |
boolean |
isSeqPresent() |
java.util.Iterator<T> |
iterator() |
static <U,R> java.util.function.Function<ListTValue<U>,ListTValue<R>> |
lift(java.util.function.Function<? super U,? extends R> fn)
Lift a function into one that accepts and returns an ListT
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
static <U1,U2,R> java.util.function.BiFunction<ListTValue<U1>,ListTValue<U2>,ListTValue<R>> |
lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
Lift a BiFunction into one that accepts and returns ListTs
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
<B> ListTValue<B> |
map(java.util.function.Function<? super T,? extends B> f)
Map the wrapped List
|
AnyM<? extends CyclopsCollectable<T>> |
nestedCollectables() |
AnyM<? extends Foldable<T>> |
nestedFoldables() |
static <A> ListTValue<A> |
of(AnyMValue<? extends java.util.List<A>> monads)
Construct an ListT from an AnyM that wraps a monad containing Lists
|
static <A> ListTValue<A> |
of(java.util.List<A> monads) |
ListTValue<T> |
peek(java.util.function.Consumer<? super T> peek)
Peek at the current value of the List
|
ReactiveSeq<T> |
stream() |
java.lang.String |
toString() |
AnyM<? extends Traversable<T>> |
transformerStream() |
<T> ListTValue<T> |
unit(T unit) |
<T> ListTValue<T> |
unitAnyM(AnyM<Traversable<T>> traversable) |
<U> ListTValue<U> |
unitIterator(java.util.Iterator<U> u) |
AnyMValue<ListX<T>> |
unwrap() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitbind, cast, combine, cycle, cycle, cycleUntil, cycleWhile, distinct, dropRight, dropUntil, dropWhile, emptyList, filterNot, fromAnyM, fromAnyMSeq, fromAnyMValue, fromFuture, fromIterable, fromIterablListue, fromOptional, fromPublisher, fromStream, fromStreamAnyM, 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, zip3, zip4, zipStream, 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, visit, visitallMatch, anyMatch, collect, collect, listT, noneMatch, setT, streamableT, streamT, toListOfLists, toNestedListX, toNestedSetX, toSetOfSetspublic boolean isSeqPresent()
isSeqPresent in interface ListT<T>isSeqPresent in interface TransformerSeq<T>public ListTValue<T> peek(java.util.function.Consumer<? super T> peek)
ListT.of(AnyM.fromStream(Arrays.asList(10))
.peek(System.out::println);
//prints 10
public ListTValue<T> filter(java.util.function.Predicate<? super T> test)
ListT.of(AnyM.fromStream(Arrays.asList(10,11))
.filter(t->t!=10);
//ListT<AnyM<Stream<List[11]>>>
filter in interface ListT<T>filter in interface Filterable<T>filter in interface FilterableFunctor<T>test - Predicate to filter the wrapped Listpublic <B> ListTValue<B> map(java.util.function.Function<? super T,? extends B> f)
ListT.of(AnyM.fromStream(Arrays.asList(10))
.map(t->t=t+1);
//ListT<AnyM<Stream<List[11]>>>
public <B> ListTValue<B> flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends B>> f)
public <B> ListTValue<B> flatMapT(java.util.function.Function<? super T,ListTValue<B>> f)
ListT.of(AnyM.fromStream(Arrays.asList(10))
.flatMap(t->List.empty();
//ListT<AnyM<Stream<List.empty>>>
f - FlatMap functionpublic static <U,R> java.util.function.Function<ListTValue<U>,ListTValue<R>> lift(java.util.function.Function<? super U,? extends R> fn)
Function<Integer,Integer> add2 = i -> i+2;
Function<ListT<Integer>, ListT<Integer>> optTAdd2 = ListT.lift(add2);
Stream<Integer> nums = Stream.of(1,2);
AnyM<Stream<Integer>> stream = AnyM.ofMonad(Arrays.asList(nums));
List<Integer> results = optTAdd2.apply(ListT.fromStream(stream))
.unwrap()
.<Optional<List<Integer>>>unwrap().get();
//Arrays.asList(3,4);
public static <U1,U2,R> java.util.function.BiFunction<ListTValue<U1>,ListTValue<U2>,ListTValue<R>> lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
BiFunction<Integer,Integer,Integer> add = (a,b) -> a+b;
BiFunction<ListT<Integer>,ListT<Integer>, ListT<Integer>> optTAdd2 = ListT.lift2(add);
Streamable<Integer> threeValues = Streamable.of(1,2,3);
AnyM<Integer> stream = AnyM.fromStreamable(threeValues);
AnyM<List<Integer>> streamOpt = stream.map(Arrays::asList);
CompletableFuture<List<Integer>> two = CompletableFuture.completedFuture(Arrays.asList(2));
AnyM<List<Integer>> future= AnyM.fromCompletableFuture(two);
List<Integer> results = optTAdd2.apply(ListT.of(streamOpt),ListT.of(future))
.unwrap()
.<Stream<List<Integer>>>unwrap()
.flatMap(i->i.stream())
.collect(Collectors.toList());
//Arrays.asList(3,4);
public static <A> ListTValue<A> fromAnyM(AnyMValue<A> anyM)
anyM - AnyM that doesn't contain a monad wrapping an Listpublic static <A> ListTValue<A> of(AnyMValue<? extends java.util.List<A>> monads)
monads - AnyM that contains a monad wrapping an Listpublic static <A> ListTValue<A> of(java.util.List<A> monads)
public static <A> ListTValue<A> fromStream(AnyMValue<? extends java.util.stream.Stream<A>> monads)
monads - public static <A,V extends MonadicValue<? extends java.util.List<A>>> ListTValue<A> fromValue(V monadicValue)
public java.lang.String toString()
toString in class java.lang.Objectpublic java.util.Iterator<T> iterator()
public <U> ListTValue<U> unitIterator(java.util.Iterator<U> u)
unitIterator in interface ListT<T>public <T> ListTValue<T> unit(T unit)
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> ListTValue<R> empty()
public static <T> ListTValue<T> emptyOptional()
emptyOptional in interface ListT<T>public boolean isListPresent()
public java.util.List<T> get()
public AnyM<? extends Foldable<T>> nestedFoldables()
nestedFoldables in interface NestedFoldable<T>public AnyM<? extends CyclopsCollectable<T>> nestedCollectables()
nestedCollectables in interface NestedCollectable<T>public <T> ListTValue<T> unitAnyM(AnyM<Traversable<T>> traversable)
unitAnyM in interface TransformerSeq<T>public AnyM<? extends Traversable<T>> transformerStream()
transformerStream in interface TransformerSeq<T>