On Thursday 26 September 2002 05:59 pm, Ola Berg wrote: > Eric Pugh writes: > >What I am wondering though is that being able to > >compare booleans is pretty basic. > > <philosophical-mode> > Is it? Which one is larger, true or false? In your code you assumed that > (true > false). Why not the other way around? </philosophical-mode> > > To me, it is tempting to consider them equal for sorting purposes, which > means that boolean values should be ignored when comparing. > That's bad. You don't want a disjunction between compareTo and equals. Since true != false, a comparison between true and false should order them.
However, you're right the ordering is essentially arbitrary for true and false. On most chips, true would be less than false, since -1 < 0, and -1 is the usual definition of true at the chip level. Conventionally, though true > false. Java dodges the issue by not defining < on boolean types. -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
