mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-01 10:48:09 +07:00
IDEA-163463 Stream API migration: type argument before map appears sometimes when it's unnecessary
15 lines
656 B
Java
15 lines
656 B
Java
// "Replace Optional.isPresent() condition with functional style expression" "true"
|
|
|
|
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();
|
|
}
|
|
} |