mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-23 07:50:55 +07:00
PR#2100 Co-authored-by: Tagir Valeev <tagir.valeev@jetbrains.com> GitOrigin-RevId: c0b8495f26bccf51c593deb6be927eb01c37d379
15 lines
661 B
Java
15 lines
661 B
Java
// "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<T> {
|
|
public static <A extends Annotation> Optional<A> findAnnotation(Optional<? extends AnnotatedElement> element) {
|
|
return element.<Optional<A>>map(annotatedElement -> annotatedElement.getAnnotations().length == 0 ? Optional.empty() : null).orElseGet(() -> findAnnotation((AnnotatedElement) null));
|
|
}
|
|
|
|
private static <A extends Annotation> Optional<A> findAnnotation(AnnotatedElement element) {
|
|
return Optional.empty();
|
|
}
|
|
} |