Package software.amazon.awssdk.utils
Class OptionalUtils
java.lang.Object
software.amazon.awssdk.utils.OptionalUtils
Functions that make working with optionals easier.
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> Optional
<T> firstPresent
(Optional<T> firstValue, Supplier<Optional<T>>... fallbackValues) Attempt to find a present-valued optional in a list of optionals.static <T> Optional
<T> firstPresent
(Optional<T> firstValue, Supplier<T> fallbackValue)
-
Method Details
-
firstPresent
@SafeVarargs public static <T> Optional<T> firstPresent(Optional<T> firstValue, Supplier<Optional<T>>... fallbackValues) Attempt to find a present-valued optional in a list of optionals.- Parameters:
firstValue
- The first value that should be checked.fallbackValues
- The suppliers we should check in order for a present value.- Returns:
- The first present value (or Optional.empty() if none are present)
-
firstPresent
-