I am attempting to sort a list a list in my class however I am running into the error above. The list comes from a method in another class.
public static List< vCtrl.CheckboxOption> convertPicklistValuesIntoCheckBox( Map<String, SobjectField> fieldMap,String fieldName){
Schema.DescribeFieldResult legacy = fieldMap.get(fieldName).getDescribe();
List<Schema.PicklistEntry> legacySeries= legacy.getPicklistValues();
List< vCtrl.CheckboxOption> listOfCheckBoxOption = new List< vCtrl.CheckboxOption>();
for (Schema.PicklistEntry entry : legacySeries)
{
vCtrl.CheckboxOption boxOption = new vCtrl.CheckboxOption();
boxOption.label = entry.getLabel();
boxOption.value = entry.getValue();
boxOption.selected = false;
listOfCheckBoxOption.add(boxOption);
}
return listOfCheckBoxOption;
}
I am using the list below in class vCtrl and want it sorted alphabetically. Calling List.sort() method on this list throws error: One or more of the items in this list is not Comparable.
listMake = Utill.convertPicklistValuesIntoCheckBox(fieldMap,'Make__c');
listMake.sort();