Мой код java7:
final Map<String, Method> result = new HashMap<>();
final Set<Class<?>> classes = getClasses(co.glue());
for (final Class<?> c : classes) {
final Method[] methods = c.getDeclaredMethods();
for (final Method method : methods) {
for (final Annotation stepAnnotation : method.getAnnotations()) {
if (stepAnnotation.annotationType().isAnnotationPresent(StepDefAnnotation.class)) {
result.put(stepAnnotation.toString(), method);
}
}
}
}
return result;
Я пытаюсь с stream
+ flatMap
+ map
+ filter
result = classes.stream()
.flatMap(c-> c.getDeclaredMethods()
.stream())
.map(Annotation::getAnnotations)
.filter(...?????);