import java.util.Optional; import java.util.function.Function; import static java.util.Optional.of; class MatchTest { { Match match = match((String s) -> s.equals("1") ? of(1) : null, s -> 1); } private Optional bar() { return null; } public static Match match(Extractor e, Function c) { return null; } class Match {} interface Extractor { Optional unapply(T t); } }