Package software.amazon.awssdk.utils
Class OptionalUtils
- java.lang.Object
-
- software.amazon.awssdk.utils.OptionalUtils
-
public final class OptionalUtils extends Object
Functions that make working with optionals easier.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <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 Detail
-
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)
-
-