| Author |
sorting collection of objects by object members
|
venkatesh loganathan
Greenhorn
Joined: Aug 24, 2004
Posts: 14
|
|
Hi all I have to sort a collection of objects based onthe object property.If the object has firstname as a member then sortg should be based on that.Any hep regarding this. Venkatesh Loganthan.
|
 |
Pete Harris
Ranch Hand
Joined: Feb 05, 2003
Posts: 39
|
|
Venkatesh, The answer here is to write a Comparator which will allow you to specify the sorting algorithm you want to use for your collection. The only thing to mention is that you should read the javadoc and implement your class with care otherwise your sort could return odd results. cheers, Pete [ September 01, 2004: Message edited by: Pete Harris ]
|
 |
Rickard Sundin
Greenhorn
Joined: Mar 10, 2003
Posts: 16
|
|
You may also want to look in on the sort methods provided by java.util.Collections (http://java.sun.com/j2se/1.4.2/docs/api/java/util/Collections.html). /Rickard
|
 |
 |
|
|
subject: sorting collection of objects by object members
|
|
|