// "Replace Optional presence condition with functional style expression" "true-preview" import java.lang.annotation.Annotation; import java.lang.reflect.AnnotatedElement; import java.util.Optional; public class Main { public static Optional findAnnotation(Optional element) { if (element.isPresent()) { return element.get().getAnnotations().length == 0 ? Optional.empty() : null; } return findAnnotation((AnnotatedElement)null); } private static Optional findAnnotation(AnnotatedElement element) { return Optional.empty(); } }