title: TernaryOperator (? :) for functions Java. How close we can get?
body: <p>Java has ternary operator, that works on variables:</p>
  
  <pre><code>(a &gt; 0) ? b++ : c--;
  </code></pre>
  
  <p>What is a, b, c were functions? I tested something like (a returns boolean, b &amp; c are void):</p>
  
  <pre><code>a() ? b() : c(); 
  </code></pre>
  
  <p>but even my Eclipse does not allow that.</p>
  
  <p><strong>How close could I get to this programmatically</strong> <em>(to generate functionality to make this with minimum amount of lines)<strong></em>?</strong></p>
  
  <p>I know in other languages like Javascript I could just pass function as parameter, but I have not met similar in Java. </p>
  
  <p><strong>Edit</strong></p>
  
  <p>We have gone in discussion to sidewals because of bad constellation of question, but here is what I want, and it is a real world problem:</p>
  
  <p><strong>What I want to achieve is single-liner to call second or third function based on return value of the first.</strong></p>
  
  <p>With minimum amount of code of course. </p>
  
  <p>What I had tried was that ternary that is made to other things, that I know now.</p>