public final class OptionalUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static <T,U> Optional<U> |
first(Optional<T> maybeT,
Function<? super T,Optional<U>>... mappers)
Returns the first non-empty value obtained by separately applying the given mappers to the given Optional.
|
static <T> Optional<T> |
firstNonEmpty(Supplier<Optional<T>>... lazyOptionals)
Returns the first of the given Optionals that is non-empty.
|
static <A,B> Optional<io.atlassian.fugue.Pair<A,B>> |
zip(Optional<A> o1,
Optional<B> o2)
Zips the two given optionals into an optional of a pair.
|
public static <A,B> Optional<io.atlassian.fugue.Pair<A,B>> zip(Optional<A> o1, Optional<B> o2)
Pair type will contain this method.A - the first typeB - the second typeo1 - the first optionalo2 - the second optional@SafeVarargs public static <T,U> Optional<U> first(Optional<T> maybeT, Function<? super T,Optional<U>>... mappers)
T - the input typeU - the output typemaybeT - the optional to which to apply the mappersmappers - the mappers to apply one by one@SafeVarargs public static <T> Optional<T> firstNonEmpty(Supplier<Optional<T>>... lazyOptionals)
T - the type of valuelazyOptionals - the optionals to inspectCopyright © 2003–2022 Atlassian. All rights reserved.