title: Check if returned value is not null and if so assign it, in one line, with one method call
body: <p>Java is littered with statements like:</p>
  
  <pre><code>if(cage.getChicken() != null) {
      dinner = cage.getChicken();
  } else {
      dinner = getFreeRangeChicken();
  }
  </code></pre>
  
  <p>Which takes two calls to <code>getChicken()</code> before the returned object can be assigned to <code>dinner</code>.</p>
  
  <p>This could also be written in one line like so:</p>
  
  <pre><code>dinner = cage.getChicken() != null? cage.getChicken() : getFreeRangeChicken();
  </code></pre>
  
  <p>But alas there are still two calls to <code>getChicken()</code>.</p>
  
  <p>Of course we could assign a local variable then use the ternary operator again to assign it if it is not null, but this is two lines and not so pretty:</p>
  
  <pre><code>FutureMeal chicken = cage.getChicken();
  dinner = chicken != null? chicken : getFreeRangeChicken();
  </code></pre>
  
  <p>So is there any way to say:</p>
  
  <blockquote>
    <p>Variable var = some value if some value is not null OR some other
    value;</p>
  </blockquote>
  
  <p>And I guess I'm just talking syntax here, after the code is compiled it probably doesn't make much difference how the code was written in a performance sense.</p>
  
  <p>As this is such common code it'd be great to have a one-liner to write it.</p>
  
  <p>Do any other languages have this feature?</p>