T
- Data type of element in this value@FunctionalInterface public interface Value<T> extends java.util.function.Supplier<T>, Foldable<T>, Convertable<T>, org.reactivestreams.Publisher<T>, java.util.function.Predicate<T>, Zippable<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Value.ValueImpl<T> |
Convertable.SupplierToConvertable<T>
Modifier and Type | Method and Description |
---|---|
default <R,A> R |
collect(java.util.stream.Collector<? super T,A,R> collector)
An equivalent operation to
Stream.collect(Collector) |
default T |
fold(Monoid<T> monoid)
Use the supplied Monoid to reduce this Value to a single result (unwraps the value stored in this Value
if the provided Monoid instance obeys the Monoid laws)
|
default T |
fold(T identity,
java.util.function.BinaryOperator<T> accumulator)
Use the supplied identity value and function to reduce this Value to a single result (unwraps the value stored in this Value
if the provided monoid combination instance obeys the Monoid laws)
|
default ReactiveSeq<T> |
generate() |
default ReactiveSeq<T> |
iterate(java.util.function.UnaryOperator<T> fn)
Use the value stored in this Value to seed a Stream generated from the provided function
|
default java.util.Iterator<T> |
iterator() |
default <E> E |
mapReduce(Reducer<E> monoid)
Attempt to map this Sequence to the same type as the supplied Monoid
(Reducer) Then use Monoid to reduce values
|
default java.lang.String |
mkString()
Returns the class name and the name of the subclass, if there is any value, the value is showed between square brackets.
|
default ValueSubscriber<T> |
newSubscriber() |
static <T> Value<T> |
of(java.util.function.Supplier<T> supplier)
Construct a generic Value from the provided Supplier
|
default ReactiveSeq<T> |
stream() |
default void |
subscribe(org.reactivestreams.Subscriber<? super T> sub) |
default boolean |
test(T t) |
default DequeX<T> |
toDequeX()
Returns a DequeX created with a list which is result of a get() call.
|
default Eval<T> |
toEvalAlways()
Return the value of this object, evaluated always.
|
default Eval<T> |
toEvalLater()
Return the value, evaluated later.
|
default Eval<T> |
toEvalNow()
Return the value, evaluated right now.
|
default FeatureToggle<T> |
toFeatureToggle()
Returns a enabled FeatureToggle in case there is an Optional in this object, otherwise returns a disabled FeatureToogle
|
default LazyFutureStream<T> |
toFutureStream()
Returns a new LazyFutureStream with the data-flow open with an array of one-off-suppliers.
|
default LazyFutureStream<T> |
toFutureStream(LazyReact reactor)
Creates a LazyFutureStream with the input LazyReact the data-flow initialized with an array of one-off-suppliers.
|
default Ior<?,T> |
toIor()
Return an Ior that can be this object or a Ior.primary or Ior.secondary
|
default LazyImmutable<T> |
toLazyImmutable() |
default java.util.List<T> |
toList() |
default ListX<T> |
toListX()
Returns a ListX created with a list which is result of a get() call.
|
default Maybe<T> |
toMaybe()
Returns a function result or a supplier result.
|
default Mutable<T> |
toMutable() |
default PBagX<T> |
toPBagX()
Returns a PBagX created with a list which is result of a get() call.
|
default POrderedSetX<T> |
toPOrderedSetX()
Returns a POrderedSetX created with a list which is result of a get() call.
|
default PQueueX<T> |
toPQueueX()
Returns a PQueueX created with a list which is result of a get() call.
|
default PSetX<T> |
toPSetX()
Returns a PSetX created with a list which is result of a get() call.
|
default PStackX<T> |
toPStackX()
Returns a PStackX created with a list which is result of a get() call.
|
default PVectorX<T> |
toPVectorX()
Returns a PVectosX created with a list which is result of a get() call.
|
default QueueX<T> |
toQueueX()
REturns a QueueX created with a list which is result of a get() call.
|
default SetX<T> |
toSetX()
Returns a SetX created with a list which is result of a get() call.
|
default SimpleReactStream<T> |
toSimpleReact()
Returns a SimpleReactStream with the dataflow open with an array of one-off-suppliers
|
default SimpleReactStream<T> |
toSimpleReact(SimpleReact reactor)
Returns the input SimpleReact with the data-flow initialized with an array of one-off-suppliers.
|
default SortedSetX<T> |
toSortedSetX()
Returns a SortedSetX created with a list which is result of a get() call.
|
default Try<T,java.lang.Throwable> |
toTry() |
default <X extends java.lang.Throwable> |
toTry(java.lang.Class<X>... classes)
Convert this Value to a Try that will catch the provided exception types on subsequent operations
|
default <X extends java.lang.Throwable> |
toTry(X throwable) |
default Xor<?,T> |
toXor() |
default <ST> Xor<ST,T> |
toXor(ST secondary)
Convert to an Xor where the secondary value will be used if no primary value is present
|
default ListX<?> |
unapply() |
endsWith, endsWithIterable, findAny, findFirst, firstValue, foldable, foldRight, foldRight, foldRight, foldRightMapToType, get, groupBy, join, join, join, mapReduce, print, print, printErr, printOut, reduce, reduce, reduce, reduce, reduce, reduce, reduce, schedule, scheduleFixedDelay, scheduleFixedRate, single, single, singleOptional, startsWith, startsWithIterable, toConcurrentLazyCollection, toConcurrentLazyStreamable, toLazyCollection, validate, xMatch
collect, fromSupplier, get, isPresent, orElse, orElseGet, orElseThrow, toAtomicReference, toCompletableFuture, toCompletableFutureAsync, toCompletableFutureAsync, toFutureW, toFutureWAsync, toFutureWAsync, toOptional, toOptionalAtomicReference, toStream, visit
default java.util.Iterator<T> iterator()
iterator
in interface Convertable<T>
iterator
in interface java.lang.Iterable<T>
default ValueSubscriber<T> newSubscriber()
default void subscribe(org.reactivestreams.Subscriber<? super T> sub)
subscribe
in interface org.reactivestreams.Publisher<T>
static <T> Value<T> of(java.util.function.Supplier<T> supplier)
supplier
- Value supplierdefault ReactiveSeq<T> stream()
stream
in interface Foldable<T>
ReactiveSeq
) of it's elementsdefault ListX<?> unapply()
default ReactiveSeq<T> iterate(java.util.function.UnaryOperator<T> fn)
fn
- Function to generate a Streamdefault ReactiveSeq<T> generate()
default <E> E mapReduce(Reducer<E> monoid)
Foldable
ReactiveSeq.of("hello","2","world","4").mapReduce(Reducers.toCountInt());
//4
default T fold(Monoid<T> monoid)
monoid
- Monoid to apply to this valuedefault T fold(T identity, java.util.function.BinaryOperator<T> accumulator)
identity
- Identity valueaccumulator
- Accumulation functiondefault LazyImmutable<T> toLazyImmutable()
default <ST> Xor<ST,T> toXor(ST secondary)
secondary
- Value to use in case no primary value is presentdefault <X extends java.lang.Throwable> Try<T,X> toTry(X throwable)
throwable
- Exception to use if this Value is emptydefault Try<T,java.lang.Throwable> toTry()
default <X extends java.lang.Throwable> Try<T,X> toTry(java.lang.Class<X>... classes)
classes
- Exception classes to catch on subsequent operationsdefault Ior<?,T> toIor()
default FeatureToggle<T> toFeatureToggle()
default Eval<T> toEvalNow()
default Eval<T> toEvalLater()
default Eval<T> toEvalAlways()
default Maybe<T> toMaybe()
default ListX<T> toListX()
default SetX<T> toSetX()
default SortedSetX<T> toSortedSetX()
default QueueX<T> toQueueX()
default DequeX<T> toDequeX()
default PStackX<T> toPStackX()
default PVectorX<T> toPVectorX()
default PQueueX<T> toPQueueX()
default PSetX<T> toPSetX()
default POrderedSetX<T> toPOrderedSetX()
default PBagX<T> toPBagX()
default java.lang.String mkString()
default LazyFutureStream<T> toFutureStream(LazyReact reactor)
reactor
- default LazyFutureStream<T> toFutureStream()
default SimpleReactStream<T> toSimpleReact(SimpleReact reactor)
reactor
- default SimpleReactStream<T> toSimpleReact()
default <R,A> R collect(java.util.stream.Collector<? super T,A,R> collector)
Convertable
Stream.collect(Collector)
collect
in interface Convertable<T>
collector
- Collector to create new Collectiondefault java.util.List<T> toList()
toList
in interface Convertable<T>