Skip to content

Instantly share code, notes, and snippets.

@Sunil02kumar
Created April 8, 2018 04:45
Show Gist options
  • Save Sunil02kumar/0c67923332148a417e820c8fb0d7e408 to your computer and use it in GitHub Desktop.
Save Sunil02kumar/0c67923332148a417e820c8fb0d7e408 to your computer and use it in GitHub Desktop.
public class SK_sortUtilityTestWrapper implements Comparable{
public string category{get;set;}
public decimal count{get;set;}
public SK_sortUtilityTestWrapper(string ss,decimal sk){
this.category=ss;
this.count=sk;
}
// Compare wrapper based on the count value.
public Integer compareTo(Object compareTo) {
// type cast object to wrapper
SK_sortUtilityTestWrapper recs = (SK_sortUtilityTestWrapper)compareTo;
// The return value of 0 indicates that both elements are equal.
Integer returnValue = 0;
if (count > recs.count) {
// Set return value to a positive value.
returnValue = 1;
} else if (count < recs.count) {
// Set return value to a negative value.
returnValue = -1;
}
return returnValue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment