| Package | Description |
|---|---|
| ar.com.kfgodel.nary.api.arity | |
| ar.com.kfgodel.nary.impl |
| Modifier and Type | Method and Description |
|---|---|
Optional<T> |
MonoElement.asOptional()
Returns a native Optional instance to be used with Nary unaware code
|
T |
MonoElement.get()
If only one value is present in this
Nary, returns the value,
otherwise throws NoSuchElementException, or MoreThanOneElementException. |
Unary<T> |
MonoElement.ifAbsent(Runnable runnable)
If the only value is absent invoke the given lambda, or else do nothing
This Nary as Stream is consumed.
|
Unary<T> |
MonoElement.ifPresent(Consumer<? super T> consumer)
If the only value is present, invoke the specified consumer with the value,
otherwise do nothing.
|
default boolean |
MonoElement.isAbsent()
Negation of isPresent().
|
boolean |
MonoElement.isPresent()
Return
true if there is only a value present, otherwise false. |
T |
MonoElement.orElse(T other)
Return the only value if present, otherwise return
other. |
T |
MonoElement.orElseGet(Supplier<? extends T> other)
Return the only value if present, otherwise invoke
other and return
the result of that invocation. |
<X extends Throwable> |
MonoElement.orElseThrow(Supplier<? extends X> exceptionSupplier)
Return the only contained value, if present, otherwise throw an exception created by the provided supplier.
|
Unary<T> |
MonoElement.orElseUse(Supplier<? extends T> mapper)
Returns a Nary element that is populated with the given supplier only if this Nary is empty.
This method allows defining a mapping function for nary that can be empty and keep chaining other mapping definitions after that. This stream is consumed and it's assumed to have at most 1 element. |
Unary<T> |
MultiElement.unique()
Treats this instance as having a single element.
|
| Modifier and Type | Method and Description |
|---|---|
Optional<Object> |
EmptyNary.asOptional() |
Optional<T> |
OneElementNary.asOptional() |
<U> Nary<U> |
EmptyNary.flatMapOptional(Function<? super Object,Optional<U>> mapper) |
<U> Nary<U> |
NarySupport.flatMapOptional(Function<? super T,Optional<U>> mapper) |
Unary<Object> |
EmptyNary.ifPresent(Consumer<? super Object> consumer) |
Unary<T> |
OneElementNary.ifPresent(Consumer<? super T> consumer) |
boolean |
EmptyNary.isAbsent() |
boolean |
OneElementNary.isAbsent() |
Object |
EmptyNary.orElse(Object other) |
T |
OneElementNary.orElse(T other) |
Object |
EmptyNary.orElseGet(Supplier<?> other) |
T |
OneElementNary.orElseGet(Supplier<? extends T> other) |
Unary<Object> |
EmptyNary.orElseUse(Supplier<?> replacer) |
Unary<T> |
OneElementNary.orElseUse(Supplier<? extends T> mapper) |
Unary<T> |
StreamBasedNary.unique() |
Copyright © 2020. All rights reserved.