Код: Выделить всё
Optional method = Arrays.stream(clazz.getMethods()).filter(m -> m.getName().equals("hello")).findFirst();
if (method.isPresent()) {
method.get().invoke(instance);
}
Код: Выделить всё
Optional method = Arrays.stream(clazz.getMethods()).filter(m -> m.getName().equals("hello")).findFirst();
if (method.isPresent()) {
Method m = method.get();
m.invoke(instance);
}
Может ли кто-нибудь объяснить это странное поведение? >
Подробнее здесь: https://stackoverflow.com/questions/792 ... ect-method
Мобильная версия