Class OptionalUtils
- java.lang.Object
-
- com.commercetools.sync.commons.utils.OptionalUtils
-
public final class OptionalUtils extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> java.util.List<T>filterEmptyOptionals(java.util.Collection<java.util.Optional<T>> optionals)Takes aCollectionofOptionals containing some elements of typeT, this method filters out any emptyOptionaland returns a new list containing the values of the non-empty optionals.static <T> java.util.List<T>filterEmptyOptionals(java.util.Optional<T>... optionals)Takes zero or moreOptionals containing some elements of typeT, this method filters out any emptyOptionaland returns a new list containing the values of the non-empty optionals.
-
-
-
Method Detail
-
filterEmptyOptionals
@Nonnull public static <T> java.util.List<T> filterEmptyOptionals(@Nonnull java.util.Collection<java.util.Optional<T>> optionals)Takes aCollectionofOptionals containing some elements of typeT, this method filters out any emptyOptionaland returns a new list containing the values of the non-empty optionals.- Type Parameters:
T- The type of the elements in the Optionals in the supplied collectionoptionals.- Parameters:
optionals- the collection of optionals that should be filtered out of empty optionals.- Returns:
- a new list containing the values of the non-empty optionals from the supplied
optionalscollection.
-
filterEmptyOptionals
@Nonnull @SafeVarargs public static <T> java.util.List<T> filterEmptyOptionals(@Nonnull java.util.Optional<T>... optionals)Takes zero or moreOptionals containing some elements of typeT, this method filters out any emptyOptionaland returns a new list containing the values of the non-empty optionals.- Type Parameters:
T- The type of the elements in the Optionals in the supplied collectionoptionals.- Parameters:
optionals- zero or more optionals that should be filtered out of empty optionals.- Returns:
- a new list containing the values of the non-empty optionals from the supplied
optionals.
-
-