Results 1 to 2 of 2
- 08-01-2007, 04:08 PM #1
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Using Comparable and Comparator interfaces
Hi, I have an array of Java objects(for example: Employee). I need to sort this array based on any one of the data variable(for example: emp_name, desg, salary) in the Java class.
I had done using Comparable and Comparator interfaces. But the problem here is need to handle both ascending and descending dynamically based on parameter passed.
Can anyone help me in this?
Thanks.
- 08-07-2007, 07:10 AM #2
Member
- Join Date
- Jul 2007
- Posts
- 40
- Rep Power
- 0
Similar Threads
-
How to search with a Comparator
By Java Tip in forum java.langReplies: 0Last Post: 04-15-2008, 07:39 PM -
How to write your own Comparator
By Java Tip in forum java.langReplies: 0Last Post: 04-15-2008, 07:38 PM -
Creating a Comparable object
By Java Tip in forum java.langReplies: 0Last Post: 04-15-2008, 07:38 PM -
interface Comparable<T> problem
By Lennon-Guru in forum New To JavaReplies: 3Last Post: 03-05-2008, 12:17 AM -
interfaces..
By sireesha in forum New To JavaReplies: 5Last Post: 01-16-2008, 05:52 PM
Bookmarks