title: Java 8 lambdas, Function.identity() or t->t
body: <p>I have a question regarding the usage of the <code>Function.identity()</code> method.</p>
  
  <p>Imagine the following code:</p>
  
  <pre><code>Arrays.asList("a", "b", "c")
            .stream()
            .map(Function.identity()) // &lt;- This,
            .map(str -&gt; str)          // &lt;- is the same as this.
            .collect(Collectors.toMap(
                         Function.identity(), // &lt;-- And this,
                         str -&gt; str));        // &lt;-- is the same as this.
  </code></pre>
  
  <p>Is there any reason why you should use <code>Function.identity()</code> instead of <code>str-&gt;str</code> (or vice versa). I think that the second option is more readable (a matter of taste of course). But, is there any "real" reason why one should be preferred?</p>