Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • 4
    I believe that the ternary operator is just sugar for an if-statemnent. Is that incorrect? Commented Jun 1, 2013 at 1:36
  • 1
    @mjCSguy it is essentially an inline if statement <-- over simplification Commented Jun 1, 2013 at 1:38
  • 1
    That does not answer the question of how a branch can be avoided. Commented Jun 1, 2013 at 1:41
  • @mjCSguy whether you use if or the ?: operator, it is highly likely that the JVM, due to JIT, will optimize to the same runtime bytecode eventually, so... Commented Jun 1, 2013 at 1:42
  • @assylias the question is, at the lowest level, can a branch be avoided? Answer: no. Commented Jun 1, 2013 at 1:42