I have a wrapper class with 2 text values. I sorted them using Comparable. It works fine for one value.
Here, I have AreaName and ADName. With the below I'm able to successfully sort by AreaName. Now I want to sort with 2 values i.e., if AreaName is same, then sort by ADName. How?
global class AreaWrapper implements Comparable{
public String AreaName{get;set;}
public String ADName{get;set;}
public AreaWrapper(){
AreaName = '';
ADName = '';
}
global Integer compareTo(Object objToCompare) {
//Sort by AreaName Alphabetically
return AreaName.compareTo(((geoAreaWrapperInner)objToCompare).AreaName);
}
}