I make myself familiar with Java 8's so called method references
.
Two questions:
1) I want to println uppercased values. How can I pass the result of String::toUpperCase
to println
? For example this block of code doesn't compile:
List<String> food = Arrays.asList("apple", "banana", "mango", "orange", "ice");
food.forEach(System.out.println(String::toUpperCase));
2) Is there something similar to anonymous function parameters (_
) like is Scala?