COMPARATOR PROBLEM:

2 views
Skip to first unread message

Jeetender Chauhan

unread,
Jan 23, 2011, 10:02:54 PM1/23/11
to cj...@googlegroups.com

Hi All,

Can any body help me out to solve the problem :

If we have 400 different attributes on the basis of which we want to sort our objects ,than i need to write 400 different comparators or is there any solution ..............

Please help me out is there any another solution ..............

please give me solution ASAP


THANKS IN ADVANCE:
--
Thanks,
Jeetender

Amit

unread,
Feb 26, 2011, 9:04:35 AM2/26/11
to cj...@googlegroups.com
Hi Jeetender,

You can create on comparator for the object. And in place of comparing all the 400 attributes better to use reflexion api. It will reduce you overhead of 400 comparison. 

Amit

Jayaram Ramanaiah

unread,
Feb 26, 2011, 9:19:45 AM2/26/11
to cj...@googlegroups.com
Write one comparator to handle 400 attributes then you will end up with only one comparator

Jayaram

--
You received this message because you are subscribed to the Google Groups "Comp Java User Group" group.
To post to this group, send email to cj...@googlegroups.com.
To unsubscribe from this group, send email to cjug+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cjug?hl=en.

Jeetender Chauhan

unread,
Feb 26, 2011, 7:37:36 PM2/26/11
to cj...@googlegroups.com
THANKS TO HELP ME BUT CAN U DO ONE MORE FAVOUR CAN PLEASE GIVE ME A SMALLL CODE SNIPPET SO THT I CAN LEARN PROPERLY!!!!!!!!!!!!

--
You received this message because you are subscribed to the Google Groups "Comp Java User Group" group.
To post to this group, send email to cj...@googlegroups.com.
To unsubscribe from this group, send email to cjug+uns...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/cjug?hl=en.



--
Thanks,
JEETENDER S CHAUHAN

Jayaram Ramanaiah

unread,
Feb 26, 2011, 10:21:23 PM2/26/11
to cj...@googlegroups.com
if you describe about your 400 comparison methods then its possible to give you sample code

Jayaram
Reply all
Reply to author
Forward
0 new messages