You need to sign in to do that
Don't have an account?
Sherwin Betonta
Method does not exist or incorrect signature: void ascending() from the type anon
I want to sort String values from a custom field from custom settings. I had no issues with the code but I get the error "Method does not exist or incorrect signature: void ascending() from the type anon'
Here's my code:
Here's my code:
public class SortNumbersFromCustomSetting { static Dev_Bootcamp__c value = Dev_Bootcamp__c.getInstance(); static List<String> ListStringValue = new List<String>(value.Random__c.split('-')); public static List<Integer> ascending(){ List<Integer> ListIntValue = new List<Integer>(); for(String str:ListStringValue){ ListIntValue.add(Integer.valueOf(str)); } ListIntValue.sort(); Set<Integer> SetIntValue = new Set<Integer>(ListIntValue); List<Integer> FinalValue = new List<Integer>(SetIntValue); return FinalValue; } public static List<Integer> descending(){ List<Integer> Temp = ascending(); List<Integer> DescIntValue = new List<Integer>(); for(Integer i = Temp.size()-1; i>=0; i--){ DescIntValue.add(Temp.get(i)); } return DescIntValue; } }
Hi Sherwin,
If you are using the above class method in any other class or if your are trying to execute the above class then use the below ways:
SortNumbersFromCustomSetting.ascending();
or
List<Integer> sortedInt = SortNumbersFromCustomSetting.ascending();
If you are directly call the method ascending() in outside of the above the class then you will get that error message.
Thanks,
Maharajan.C