public Optional<T> filter(Predicate<? super T> predicate) {
        Objects.requireNonNull(predicate);
        if (!isPresent())
            return this;
        else
            return predicate.test(value) ? this : empty();
    }
If a value is present, and the value matches the given predicate,
return an {@code Optional} describing the value, otherwise return an
empty {@code Optional}.

@param predicate a predicate to apply to the value, if present
@return an {@code Optional} describing the value of this {@code Optional}
if a value is present and the value matches the given predicate,
otherwise an empty {@code Optional}
@throws NullPointerException if the predicate is null
android/android_framework/base/src/main/java/github/tornaco/android/thanos/core/util/Optional.java