Java 8 lambdas, Function.identity() or t->t
I have a question regarding the usage of the Function.identity() method. Imagine the following code: Arrays.asList(“a”, “b”, “c”) .stream() .map(Function.identity()) // <- This, .map(str -> str) // <- is the same as this. .collect(Collectors.toMap( Function.identity(), // <– And this, str -> str)); // <– is the same as this. Is there any reason why you … Read more