I can use reflection to dynamically get a method and call it. How can I do the same with a lambda? IE something like
class Foo{
public static String mapper(Object o){
return "dummy val";
}
}
class Bar {
public static void main(String args[]){
String[] arr = {"a", "b", "c"};
Lambda reflectedMapper = ReflectionUtils.getLambda("Foo.mapper");//How do I actually write this line?
List<String> mapped = arr.stream().map(reflectedMapper).collect(Collectors.toList();
}
}
Aucun commentaire:
Enregistrer un commentaire