Home » questions » Sorting a array of objects according to a characteristic in each object in java?
Sorting a array of objects according to a characteristic in each object in java?
I want to sort a set of objects in a array according to particular characteristic in each object. Like the object in array[0] name is "billy" and the object in array[1] name is "Adam" I want the object with the name = adam to be sorted so it is placed first in the array, you know like alphabetically. Now if I were doign this in C++ I could just like over-load a operator and compare those two things between objects and switch them around using a bubble sort or something. But it doesn't seem like you can over-load a operator in java, which kinda sucks, how would I do this whole "sorting of objects" if you will in java?

Answers
Luay
On 2006-08-13 10:53:52
Sean I.T ©
On 2006-08-13 10:57:46
rohitn23 s
On 2006-08-13 11:54:26
celesoft
On 2006-08-13 11:01:17