function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sherwin BetontaSherwin 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:
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){
         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--){
        return DescIntValue;

Best Answer chosen by Sherwin Betonta
Maharajan CMaharajan C

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:



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.