I’d like to take a moment to thank whoever it was who decided that Boolean should not implement Comparable in JDK 1.4. It must have been tough avoiding the temptation to add the five lines to the JDK, especially since Byte, Character, Short, Long, Float, Double, and String all have a compareTo() method.
Not only does this masterstroke assist the relentless fight against JDK bloat, it also causes some particularly bizzare ClassCastExceptions, enhancing my reputation amongst those that treat Java programmers like animist witch doctors, and assuring my continued employment.
So, thankyou. Thankyou so much.
(Sadly, this feature has been removed in JDK 1.5. As a workaround, I suggest throwing ClassCastExceptions from a java.util.TimerTask.)
Comments
well, jdk1.5 doesn't compile if(true>false).
philosophyically, it's quite wrong to define an order between true and false.
I agree with the philosophy, but in practice, when trying to define an ordering on a domain class, it's quite handy to compare Booleans.