&&
is "short circuiting". The expression on the right is never executed if the expression on the left evaluates to false.
The same is true for ||
, which never executes the expression on the right if the expression on the left is true.
&
and |
are normally used for bit operations on integers, but can also be used on booleans. These are not short-circuiting. If you had done
if ((some_list != null) & (some_list.size() > 0)) {
then it would have failed in exactly the way you're asking about.