File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
sorting collection of objects by object members
Joined: Aug 24, 2004
Sep 01, 2004 02:20:00
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.
Joined: Feb 05, 2003
Sep 01, 2004 02:36:00
The answer here is to write a
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.
[ September 01, 2004: Message edited by: Pete Harris ]
Joined: Mar 10, 2003
Sep 02, 2004 05:37:00
You may also want to look in on the sort methods provided by
I agree. Here's the link:
subject: sorting collection of objects by object members
How To Get Rid Of java.util.ConcurrentModificationException?
Sorting using Comparable interface
duplicate/unique value count generics list
Sorting Collection of objects by object members
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013