Using the new features of Java 8, what is the most concise way of transforming all the values of a List<String>
?
Given this:
List<String> words = Arrays.asList("Apple", "Ananas", "Mango", "Banana", "Beer");
I am currently doing this:
for (int n = 0; n < words.size(); n++) {
words.set(n, words.get(n).toUpperCase());
}
How can the new Lambdas, Collections and Streams API in Java 8 help:
transform the values in-place (without creating a new list)
transform the values into a new result list.