In case you want to have an Optional argument in your function rather do it using another functional interface. For example:
void doSomething(Supplier<Optional<String>> urlSupplier) { urlSupplier.get() .filter(StringUtils::isNotBlank) .isPresent((url) -> System.out.println(url));}
You can use Function instead of Supplier it is up to you. Then you can just call it. For example:
void myMethod() { doSomething(() -> methodToGetUrlAsOptional());}