Advertisement

02.19.2008 at 02:12PM PST, ID: 23175900
[x]
Attachment Details

reverse sort an ArrayList

Asked by DJ_AM_Juicebox in Java Programming Language

Hi,

I have a class and I've implemented the Comparable interface for it so I can use Collections.sort() on it. Is there any way to do a one line reverse sort? For right now I am doing:

     ArrayList<MyClass> m;
     Collections.sort(m);
     Collections.reverse(m);

in order to reverse it..... the comparable interface is already defined, so shouldn't there be some method to just use that interface to do a reverse sorting for you?

ThanksStart Free Trial
[+][-]02.19.2008 at 02:16PM PST, ID: 20933185

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.19.2008 at 09:18PM PST, ID: 20935289

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.19.2008 at 11:14PM PST, ID: 20935672

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.20.2008 at 12:12AM PST, ID: 20935873

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.20.2008 at 12:18AM PST, ID: 20935901

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Java Programming Language
Sign Up Now!
Solution Provided By: Bart_Cr
Participating Experts: 3
Solution Grade: A
 
 
[+][-]02.20.2008 at 12:32AM PST, ID: 20935953

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.24.2008 at 11:33AM PDT, ID: 21433771

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628