I want to sort a custom wrapper list. A piece of code is shown below.
public List<Subscription__c> subs;
public TerritoryBusinessUnit__c tlBU;
public class wrap {
public boolean selection { set; get; }
public subscription__c sub { set; get; }
public wrap(boolean sel, subscription__c s) {
selection = sel;
sub = s;
}
}
public List<wrap> wrapls = new List<wrap>();
public List<wrap> subList {
set;
get{
return wrapls;
}
}
public void Laodsubscriptions()
{
subs=[some condition here]
tlBU=[SELECT ID,Name, TerritoryLabel__c, MID__c, FetchType__c,Address__c
FROM TerritoryBusinessUnit__c
WHERE MID__c=:ApexPages.currentpage().getparameters().get('mid')];
if(tlBu.FetchType__c == 'L')
{
//some logic
}
wraps.sort();
}
Error:
One or more of the items in this list is not Comparable.
Please let me know what best can be done to resolve this.