title: Are there good uses for non-short-circuiting logical (boolean) operators in Java/Scala?
body: <p>I recently discovered that Java (and Scala) include non-short-circuiting logical operators <code>&amp;</code>, <code>|</code>, and <code>^</code>.  I previously thought these only worked as bitwise operators.  While maybe there is an argument for <code>^</code>, I can't think of very good reasons for using non-short-circuiting logical operators--although sure, I can contrive an example.</p>
  
  <p>Are these operators useful?  They seem more likely to cause hard-to-catch bugs.</p>
  
  <pre><code>scala&gt; def foo = {
       |   println("foo")
       |   true
       | }
  foo: Boolean
  
  scala&gt; def bar = {
       |   println("bar")
       |   true
       | }
  bar: Boolean
  
  scala&gt; foo || bar
  foo
  res5: Boolean = true
  
  scala&gt; foo | bar
  foo
  bar
  res6: Boolean = true
  </code></pre>