Name: stC104175 Date: 04/12/2000
(see also 4214818)
java version "1.2"
Classic VM (build JDK-1.2-V, native threads)
Boolean doesn't implement the Comparable interface.
This means that we can't put it into a JTable and assume that objects in the
model will be sorted according their comparable interface.
Replace table by any type of collection object and you see this is a serious
drawback.
We have to check if the object is boolean or not instead of using comparable interface.
I can't understand the reason.
One could be that establish a natural order for Boolean objects could sound
ridiculous, but i can suggest one, true first, false second. Or another
convention, true second, false first. Any possibilities???.
Lets imagine a JTable with checkbox, integers, text and you want to see first
the items that are checked, but like boolean objects doesn't implement
comparable, the user can't group them.
Of course you can redesign the JTable Model and instead of cast objects to
comparable, you can start to use a beatiful collection of if and instanceof, but
we are talking about OOP, aren't we?
Call it bug, design problem or omission, but sure it is a problem
(Review ID: 102386)
======================================================================