ClassCastException while implementing Comparable interface and its compareTo method
Posted on 2004-09-16
Hope you all are doing good....
Here I am having a bit bitter experience in using a Comparable interface and its compareTo method.
The thing is iam trying to sort a collection of objects . The object contains 5 fields- one int 2 Date and 3 string fileds and these fileds have respective getter and setter method in a bean where I have implemented Comparable interface and its method compareTo.
And all this is done in structs-Tomcat.
I get ClassCastException though I get an output in the screen. Its sorting in the ascending order, allright.. but I need to remove the classcastexception and after that I need to sort them in the descending order...
Thanks in advance