T
- public interface Convertable<T>
extends java.lang.Iterable<T>, java.util.function.Supplier<T>
Modifier and Type | Interface and Description |
---|---|
static class |
Convertable.SupplierToConvertable<T> |
Modifier and Type | Method and Description |
---|---|
static <T> Convertable<T> |
fromSupplier(java.util.function.Supplier<T> supplier)
Construct a Convertable from a Supplier
|
T |
get() |
default java.util.Iterator<T> |
iterator() |
default T |
orElse(T value)
Get the contained value or else the provided alternative
|
default T |
orElseGet(java.util.function.Supplier<? extends T> value) |
default <X extends java.lang.Throwable> |
orElseThrow(java.util.function.Supplier<? extends X> ex)
Get the contained value or throw an exception if null
|
default java.util.concurrent.atomic.AtomicReference<T> |
toAtomicReference() |
default java.util.concurrent.CompletableFuture<T> |
toCompletableFuture() |
default java.util.concurrent.CompletableFuture<T> |
toCompletableFutureAsync() |
default java.util.concurrent.CompletableFuture<T> |
toCompletableFutureAsync(java.util.concurrent.Executor exec) |
default FutureW<T> |
toFutureW() |
default java.util.List<T> |
toList() |
default java.util.Optional<T> |
toOptional() |
default java.util.Optional<java.util.concurrent.atomic.AtomicReference<T>> |
toOptionalAtomicReference() |
default java.util.stream.Stream<T> |
toStream() |
default <R> R |
visit(java.util.function.Function<? super T,? extends R> present,
java.util.function.Supplier<? extends R> absent) |
static <T> Convertable<T> fromSupplier(java.util.function.Supplier<T> supplier)
supplier
- That returns the convertable valueT get()
get
in interface java.util.function.Supplier<T>
default <R> R visit(java.util.function.Function<? super T,? extends R> present, java.util.function.Supplier<? extends R> absent)
default java.util.Optional<T> toOptional()
default java.util.stream.Stream<T> toStream()
default java.util.concurrent.atomic.AtomicReference<T> toAtomicReference()
default java.util.Optional<java.util.concurrent.atomic.AtomicReference<T>> toOptionalAtomicReference()
default T orElse(T value)
value
- default <X extends java.lang.Throwable> T orElseThrow(java.util.function.Supplier<? extends X> ex) throws X extends java.lang.Throwable
ex
- X
X extends java.lang.Throwable
default java.util.List<T> toList()
default java.util.Iterator<T> iterator()
iterator
in interface java.lang.Iterable<T>
default java.util.concurrent.CompletableFuture<T> toCompletableFuture()
default java.util.concurrent.CompletableFuture<T> toCompletableFutureAsync()
default java.util.concurrent.CompletableFuture<T> toCompletableFutureAsync(java.util.concurrent.Executor exec)
exec
- Executor to asyncrhonously populate the CompletableFuture