T
- The type contained on the Set withinpublic class SetTValue<T> extends java.lang.Object implements SetT<T>, ConvertableSequence<T>, TransformerSeq<T>, org.reactivestreams.Publisher<T>
Modifier and Type | Method and Description |
---|---|
<R> SetTValue<R> |
empty() |
static <T> SetTValue<T> |
emptyOptional() |
boolean |
equals(java.lang.Object o) |
SetTValue<T> |
filter(java.util.function.Predicate<? super T> test)
Filter the wrapped Set
|
<B> SetTValue<B> |
flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends B>> f) |
<B> SetTValue<B> |
flatMapT(java.util.function.Function<? super T,SetTValue<B>> f)
Flat Map the wrapped Set
|
static <A> SetTValue<A> |
fromAnyM(AnyMValue<A> anyM)
|
static <A> SetTValue<A> |
fromStream(AnyMValue<java.util.stream.Stream<A>> monads)
Create a SetT from an AnyM that wraps a monad containing a Stream
|
static <A,V extends MonadicValue<? extends java.util.Set<A>>> |
fromValue(V monadicValue) |
java.util.Set<T> |
get() |
int |
hashCode() |
boolean |
isSeqPresent() |
boolean |
isSetPresent() |
java.util.Iterator<T> |
iterator() |
static <U,R> java.util.function.Function<SetTValue<U>,SetTValue<R>> |
lift(java.util.function.Function<? super U,? extends R> fn)
Lift a function into one that accepts and returns an SetT
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
static <U1,U2,R> java.util.function.BiFunction<SetTValue<U1>,SetTValue<U2>,SetTValue<R>> |
lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
Lift a BiFunction into one that accepts and returns SetTs
This allows multiple monad types to add functionality to existing functions and methods
e.g.
|
<B> SetTValue<B> |
map(java.util.function.Function<? super T,? extends B> f)
Map the wrapped Set
|
AnyM<? extends CyclopsCollectable<T>> |
nestedCollectables() |
AnyM<? extends IterableFoldable<T>> |
nestedFoldables() |
static <A> SetTValue<A> |
of(AnyMValue<? extends java.util.Set<A>> monads)
Construct an SetT from an AnyM that wraps a monad containing Sets
|
static <A> SetTValue<A> |
of(java.util.Set<A> monads) |
SetTValue<T> |
peek(java.util.function.Consumer<? super T> peek)
Peek at the current value of the Set
|
ReactiveSeq<T> |
stream() |
java.lang.String |
toString() |
AnyM<? extends Traversable<T>> |
transformerStream() |
<T> SetTValue<T> |
unit(T unit) |
<T> SetTValue<T> |
unitAnyM(AnyM<Traversable<T>> traversable) |
<U> SetTValue<U> |
unitIterator(java.util.Iterator<U> u) |
AnyMValue<SetX<T>> |
unwrap() |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
bind, cast, combine, cycle, cycle, cycleUntil, cycleWhile, distinct, dropRight, dropUntil, dropWhile, emptySet, filterNot, fromAnyM, fromAnyMSeq, fromAnyMValue, fromFuture, fromIterable, fromIterableValue, fromOptional, fromPublisher, fromStream, fromStream, grouped, grouped, grouped, grouped, groupedStatefullyUntil, 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, zipWithIndex
futureOperations, lazyOperations, subscribe
seq, 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, toXorSecondary
traversable
fixedDelay, onePer, xPer
futureStream, getStreamable, isEmpty, jdkStream, reactiveSeq, reveresedJDKStream, reveresedStream
endsWith, 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
allMatch, anyMatch, collect, collect, listT, noneMatch, setT, streamableT, streamT, toListOfLists, toNestedListX, toNestedSetX, toSetOfSets
public boolean isSeqPresent()
isSeqPresent
in interface TransformerSeq<T>
public SetTValue<T> peek(java.util.function.Consumer<? super T> peek)
SetT.of(AnyM.fromStream(Arrays.asSet(10))
.peek(System.out::println);
//prints 10
public SetTValue<T> filter(java.util.function.Predicate<? super T> test)
SetT.of(AnyM.fromStream(Arrays.asSet(10,11))
.filter(t->t!=10);
//SetT<AnyM<Stream<Set[11]>>>
filter
in interface SetT<T>
filter
in interface Filterable<T>
filter
in interface FilterableFunctor<T>
test
- Predicate to filter the wrapped Setpublic <B> SetTValue<B> map(java.util.function.Function<? super T,? extends B> f)
SetT.of(AnyM.fromStream(Arrays.asSet(10))
.map(t->t=t+1);
//SetT<AnyM<Stream<Set[11]>>>
public <B> SetTValue<B> flatMapT(java.util.function.Function<? super T,SetTValue<B>> f)
SetT.of(AnyM.fromStream(Arrays.asSet(10))
.flatMap(t->Set.empty();
//SetT<AnyM<Stream<Set.empty>>>
f
- FlatMap functionpublic <B> SetTValue<B> flatMap(java.util.function.Function<? super T,? extends java.lang.Iterable<? extends B>> f)
public static <U,R> java.util.function.Function<SetTValue<U>,SetTValue<R>> lift(java.util.function.Function<? super U,? extends R> fn)
Function<Integer,Integer> add2 = i -> i+2;
Function<SetT<Integer>, SetT<Integer>> optTAdd2 = SetT.lift(add2);
Stream<Integer> nums = Stream.of(1,2);
AnyM<Stream<Integer>> stream = AnyM.ofMonad(asSet(nums));
Set<Integer> results = optTAdd2.apply(SetT.fromStream(stream))
.unwrap()
.<Optional<Set<Integer>>>unwrap().get();
//asSet(3,4);
public static <U1,U2,R> java.util.function.BiFunction<SetTValue<U1>,SetTValue<U2>,SetTValue<R>> lift2(java.util.function.BiFunction<? super U1,? super U2,? extends R> fn)
BiFunction<Integer,Integer,Integer> add = (a,b) -> a+b;
BiFunction<SetT<Integer>,SetT<Integer>, SetT<Integer>> optTAdd2 = SetT.lift2(add);
Streamable<Integer> threeValues = Streamable.of(1,2,3);
AnyM<Integer> stream = AnyM.fromStreamable(threeValues);
AnyM<Set<Integer>> streamOpt = stream.map(this::asSet);
CompletableFuture<Set<Integer>> two = CompletableFuture.completedFuture(asSet(2));
AnyM<Set<Integer>> future= AnyM.fromCompletableFuture(two);
Set<Integer> results = optTAdd2.apply(SetT.of(streamOpt),SetT.of(future))
.unwrap()
.<Stream<Set<Integer>>>unwrap()
.flatMap(i->i.stream())
.collect(Collectors.toSet());
//asSet(3,4);
public static <A> SetTValue<A> fromAnyM(AnyMValue<A> anyM)
anyM
- AnyM that doesn't contain a monad wrapping an Setpublic static <A> SetTValue<A> of(AnyMValue<? extends java.util.Set<A>> monads)
monads
- AnyM that contains a monad wrapping an Setpublic static <A> SetTValue<A> of(java.util.Set<A> monads)
public boolean isSetPresent()
public java.util.Set<T> get()
public static <A> SetTValue<A> fromStream(AnyMValue<java.util.stream.Stream<A>> monads)
monads
- public static <A,V extends MonadicValue<? extends java.util.Set<A>>> SetTValue<A> fromValue(V monadicValue)
public java.lang.String toString()
toString
in class java.lang.Object
public java.util.Iterator<T> iterator()
public <U> SetTValue<U> unitIterator(java.util.Iterator<U> u)
unitIterator
in interface SetT<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 static <T> SetTValue<T> emptyOptional()
public AnyM<? extends IterableFoldable<T>> nestedFoldables()
nestedFoldables
in interface NestedFoldable<T>
public AnyM<? extends CyclopsCollectable<T>> nestedCollectables()
nestedCollectables
in interface NestedCollectable<T>
public <T> SetTValue<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.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object