title: Is the ternary operator faster than an "if" condition in Java
body: <p>I am prone to "<em>if-conditional syndrome</em>" which means I tend to use if conditions all the time. I rarely ever use the ternary operator. For instance:
  </p>
  
  <pre class="lang-java prettyprint-override"><code>//I like to do this:
  int a;
  if (i == 0)
  {
      a = 10;
  }
  else
  {
      a = 5;
  }
  
  //When I could do this:
  int a = (i == 0) ? 10:5;
  </code></pre>
  
  <p>Does it matter which I use? Which is faster? Are there any notable performance differences? Is it a better practice to use the shortest code whenever possible?</p>