Additional top-level class in compilation unit: ValueModule.
Value
type reflects the values in a functional setting. It can be seen as the result of a partial function application.
Hence the result may be undefined. If a value is undefined, we say it is empty.
How the empty state is interpreted depends on the context, i.e. it may be undefined, failed, no elements, etc.
Basic operations:
get()getOrElse(Object)getOrElse(Supplier)getOrElseThrow(Supplier)getOrElseTry(CheckedFunction0)getOrNull()map(Function)stringPrefix()collect(Collector)collect(Supplier, BiConsumer, BiConsumer)toArray()toCharSeq()toEither(Object)toEither(Supplier)toInvalid(Object)toInvalid(Supplier)toJavaArray()toJavaArray(Class)toJavaCollection(Function)toJavaList()toJavaList(Function)toJavaMap(Function)toJavaMap(Supplier, Function)toJavaMap(Supplier, Function, Function) toJavaOptional()toJavaParallelStream()toJavaSet()toJavaSet(Function)toJavaStream()toLeft(Object)toLeft(Supplier)toLinkedMap(Function)toLinkedMap(Function, Function)toLinkedSet()toList()toMap(Function)toMap(Function, Function)toOption()toPriorityQueue()toPriorityQueue(Comparator)toQueue()toRight(Object)toRight(Supplier)toSet()toSortedMap(Comparator, Function)toSortedMap(Comparator, Function, Function)toSortedMap(Function)toSortedMap(Function, Function)toSortedSet()toSortedSet(Comparator)toStream()toString()toTree()toTry()toTry(Supplier)toValid(Object)toValid(Supplier)toValidation(Object)toValidation(Supplier)toVector()Note
flatMap signatures are manifold and have to be declared by subclasses of Value.
| Modifier and Type | Method and Description |
|---|---|
| public default < the result type of the reduction operation R, the mutable accumulation type of the reduction operation A> R | |
| public default < type of the result R> R | Returns: R reduction resultprovide unit value for reduction supplier, BiConsumer<R, ? super T> perform reduction with unit value accumulator, BiConsumer<R, R> function for combining two values, which must be
compatible with the accumulator. combiner)Collects the underlying value(s) (if present) using the given |
| public default boolean | Returns: true, if element is contained, false otherwise.An Object of type A, may be null. element)Shortcut for |
| public default < Component type of that iterable U> boolean | Returns: true if both iterables have the same length and predicate(x, y)
is true for all corresponding elements x of this iterable and y of that,
otherwise false.the other iterable that, BiPredicate<? super T, ? super U> the test predicate, which relates elements from both iterables predicate)Tests whether every element of this iterable relates to the corresponding element of another iterable by satisfying a test predicate. |
| public default boolean | |
| public boolean | |
| public default boolean | |
| public default boolean | |
| public default void | forEach(Consumer<? super T>
A action)ConsumerOverrides default java. Performs an action on each element. |
| public T | Returns: the underlying value if this is not empty, otherwiseget() throws a ThrowableGets the underlying value or throws if no value is present. |
| public default T | Returns: A value of typeTAn alternative value. other)Returns the underlying value if present, otherwise |
| public default T | |
| public default < a Throwable type X extends Throwable> T | Returns: A value of typeT.An exception supplier. supplier)Returns the underlying value if present, otherwise throws |
| public default T | Returns: A value of typeT.An alternative value supplier. supplier)Returns the underlying value if present, otherwise returns the result of |
| public default T | Returns: A value of typeT or null.Returns the underlying value if present, otherwise |
| public int | Returns: The hashcode of this objectClarifies that values have a proper hashCode() method implemented. |
| public boolean | |
| public boolean | Returns: false, if no underlying value is present, true otherwise.Checks, this |
| public boolean | |
| public boolean | Returns: true if this is single-valued, false otherwise.States whether this is a single-valued type. |
| public Iterator | Returns: A new IteratorRedeclares java. Returns a rich |
| public < The new component type U> Value | |
| public static < Component type of the T> ValueValue. | |
| public default void | out(PrintStream
The PrintStream to write to out)Sends the string representations of this to the |
| public default void | out(PrintWriter
The PrintWriter to write to writer)Sends the string representations of this to the |
| public Value | |
| public default Spliterator | spliterator()
Overrides default java. Creates a |
| public default void | |
| public default void | |
| public String | Returns: This type name.Returns the name of this Value type, which is used by toString(). |
| public default Array | |
| public default CharSeq | |
| public default CompletableFuture | Returns: A newCompletableFuture containing the valueConverts this to a |
| public default < Either left component type L> Either | |
| public default < Validation error component type L> Either | |
| public default < value type of a U> ValidationValid | Returns: A newValidation. containing the given value if this is empty, otherwise
a new Validation. containing this value.An instance of a value)Valid value
Deprecated
Use
toValidation(Object) instead.
Converts this to a |
| public default < value type of a U> ValidationValid | Returns: A newValidation. containing the result of valueSupplier if this is empty,
otherwise a new Validation. containing this value.A supplier of a valueSupplier)Valid value
Deprecated
Use
toValidation(Supplier) instead.
Converts this to a |
| public default Object[] | Returns: A new Java array.Converts this to a Java array with component type
|
| public default T[] | Returns: A new Java array.Component type of the array componentType)
Deprecated
Use
toJavaArray(IntFunction) instead
Converts this to a Java array having an accurate component type. |
| public default T[] | Returns: The array provided by the factory filled with the values from thisValue.an arrayFactory)int argument function that
creates an array of the correct component
type with the specified sizeConverts this to a Java array having an accurate component type. |
| public default < a sub-type of C extends Collectionjava.util.Collection | Returns: a newjava.util.Collection of type CA factory that returns an empty mutable factory)java.util.Collection with the specified initial capacityConverts this to a specific mutable |
| public default List | |
| public default < A sub-type of LIST extends Listjava.util.List | Returns: a newjava.util.List of type LISTA factory that returns an empty mutable factory)java.util.List with the specified initial capacityConverts this to a specific mutable |
| public default < The key type K, The value type V> Map | Returns: A newjava..A function that maps an element to a key/value pair represented by Tuple2 f)Converts this to a mutable |
| public default < The key type K, The value type V, a sub-type of MAP extends Mapjava.util.Map | Returns: a newjava.util.Map of type MAPA factory that creates an empty mutable factory, Function<? super T, ? extends K> java.util.MapA function that maps an element to a key keyMapper, Function<? super T, ? extends V> A function that maps an element to a value valueMapper)Converts this to a specific mutable |
| public default < The key type K, The value type V, a sub-type of MAP extends Mapjava.util.Map | Returns: a newjava.util.Map of type MAPA factory that creates an empty mutable factory, Function<? super T, ? extends Tuple2<? extends K, ? extends V>> java.util.MapA function that maps an element to a key/value pair represented by Tuple2 f)Converts this to a specific mutable |
| public default Optional | |
| public default Stream | Returns: A new paralleljava..Converts this to a parallel |
| public default Set | |
| public default < a sub-type of SET extends Setjava.util.Set | Returns: a newjava.util.Set of type SETA factory that returns an empty mutable factory)java.util.Set with the specified initial capacityConverts this to a specific |
| public default Stream | Returns: A new sequentialjava..Converts this to a sequential |
| public default < right type R> Either | Returns: A newEither. containing the value of right if this is empty, otherwise
a new Either. containing this value.An instance of a right value right)
Deprecated
Use
toEither(Object) instead.
Converts this to a |
| public default < right type R> Either | Returns: A newEither. containing the result of right if this is empty, otherwise
a new Either. containing this value.A supplier of a right value right)
Deprecated
Use
toEither(Supplier) instead.
Converts this to a |
| public default < The key type K, The value type V> Map | Returns: A newLinkedHashMap.A function that maps an element to a key keyMapper, Function<? super T, ? extends V> A function that maps an element to a value valueMapper)Converts this to a |
| public default < The key type K, The value type V> Map | Returns: A newLinkedHashMap.A function that maps an element to a key/value pair represented by Tuple2 f)Converts this to a |
| public default Set | |
| public default List | |
| public default < The key type K, The value type V> Map | |
| public default < The key type K, The value type V> Map | |
| public default Option | |
| public default PriorityQueue | |
| public default PriorityQueue | Returns: A newPriorityQueue.A comparator that induces an order of the PriorityQueue elements. comparator)Converts this to a |
| public default Queue | |
| public default < left type L> Either | Returns: A newEither. containing the value of left if this is empty, otherwise
a new Either. containing this value.An instance of a left value left)
Deprecated
Use
toEither(Object) instead.
Converts this to a |
| public default < left type L> Either | Returns: A newEither. containing the result of left if this is empty, otherwise
a new Either. containing this value.A supplier of a left value left)
Deprecated
Use
toEither(Supplier) instead.
Converts this to a |
| public default Set | |
| public default < The key type K extends ComparableThe value type V> SortedMap | Returns: A newTreeMap.A function that maps an element to a key keyMapper, Function<? super T, ? extends V> A function that maps an element to a value valueMapper)Converts this to a |
| public default < The key type K extends ComparableThe value type V> SortedMap | Returns: A newTreeMap.A function that maps an element to a key/value pair represented by Tuple2 f)Converts this to a |
| public default < The key type K, The value type V> SortedMap | Returns: A newTreeMap.A comparator that induces an order of the Map keys. comparator, Function<? super T, ? extends K> A function that maps an element to a key keyMapper, Function<? super T, ? extends V> A function that maps an element to a value valueMapper)Converts this to a |
| public default < The key type K, The value type V> SortedMap | Returns: A newTreeMap.A comparator that induces an order of the Map keys. comparator, Function<? super T, ? extends Tuple2<? extends K, ? extends V>> A function that maps an element to a key/value pair represented by Tuple2 f)Converts this to a |
| public default SortedSet | |
| public default SortedSet | Returns: A newTreeSet.A comparator that induces an order of the SortedSet elements. comparator)Converts this to a |
| public default Stream | |
| public String | Returns: A String representation of this objectClarifies that values have a proper toString() method implemented. |
| public default Tree | |
| public default < Id type ID> List | Returns: A newTree.A mapper from source item to unique identifier of that item idMapper, Function<? super T, ? extends ID> A mapper from source item to unique identifier of parent item. Need return null for root items parentMapper)Converts this to a |
| public default Try | |
| public default Try | |
| public default < error type of an E> ValidationInvalid | Returns: A newValidation. containing the given error if this is empty, otherwise
a new Validation. containing this value.An error error)
Deprecated
Use
toValidation(Object) instead.
Converts this to a |
| public default < error type of an E> ValidationInvalid | Returns: A newValidation. containing the result of errorSupplier if this is empty,
otherwise a new Validation. containing this value.A supplier of an error errorSupplier)
Deprecated
Use
toValidation(Supplier) instead.
Converts this to a |
| public default < Validation error component type E> Validation | Returns: A newValidation.An invalid value for the invalid)ValidationConverts this to an |
| public default < Validation error component type E> Validation | Returns: A newValidation.A invalidSupplier)Supplier for the invalid value for the ValidationConverts this to an |
| public default Vector |