+ 2
Java sorting of object field
I have made user defined objects and stored objects in arraylist, now i want to sort the arraylist on bases of one of the field of class One option is comparator and comparable but other than this is there any way?
2 Answers
+ 11
you must override compareTo method...
+ 1
I have tried to get each object from arraylist then compare it will other objects field and apply bubble sort but it won't work. I will try overloading tocompare