title: local variable for compare with null
body: <p>I have found some new code practice (in the guava source code)for me.</p>
  
  <pre><code>public Set&lt;K&gt; keySet() {
     Set&lt;K&gt; result = keySet;
     return (result == null) ? keySet = new KeySet() : result;   
  }    
  </code></pre>
  
  <p>My question is - why there is used local variable resut for comparing with null? Is there any andvantage? </p>
  
  <p>is it not the same like</p>
  
  <pre><code> public Set&lt;K&gt; keySet() {
     return (keySet== null) ? keySet = new KeySet() : keySet;   
   } 
  </code></pre>