function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
pujapuja 

sort wrapper list

Hi,

 

I have a wrapper list which contains an integer value, a product record and a boolean value. 

my requirement is to sort that list according to the product name..

 

please help...its urgent.

 

 

 

 

 

Thanks in advanced

Abhay AroraAbhay Arora

Hi,

 

Why dont you just query them in a order and add to the list of wrapper in same way

 

Say select id,name from account order by name asc

 

for(account acc: lstacc{

wrapper.put(acc);

}

sfdcfoxsfdcfox

Summer 12, List.Sort can sort SObjects and classes with a particular interface. Can you wait that long? If not, you can make your own custom list sorting algorithm. I used the http://en.wikipedia.org/wiki/Gnome_sort in one version of code I wrote once, and a selective bubble sort in another. You can use any algorithm that makes sense to you.

nagalakshminagalakshmi

Hi Puja,

 

Did you solve this issue. I am also having the same requirement.......Please help me out.

 

Thanks,

Lakshmi

hemantgarghemantgarg