There are 2 classes: Dataclass and Sortclass. The Dataclass is processing and storing data. The Sortclass must sort data. But when I call the sorting method from Sortclass I get the error: "Method does not exist or type: void sortStatic () from the type List ". My question is: how can I fix this and execute the action?

public with sharing class Dataclass {
try {
        for(DarexSort__c sortobj : sortAdRec){
            String sortString = sortobj.Unsifie__c;
            List<String> sortList = sortString.split(',');
            List<Integer> intList = new List<Integer>();
            for(String s : sortList){
            intList.sortStatic(); // Error here
            sortString = string.join(intList,',');
            sortobj.Sofie__c = sortString;
        update sortRec;  

public class Sortclass{
  private List<Integer> mNumbers;
  private Integer mNumber;
  public static void sortStatic(List<Integer> values){
        (new Quicksort()).sort(values);

  private void exchange(Integer i, Integer j) {
    Integer temp = mNumbers[i];
    mNumbers[i] = mNumbers[j];
    mNumbers[j] = temp;
  • Why use a custom sort class instead of just using Comparable? – sfdcfox Jun 27 '19 at 14:40


The line should look like this. You are trying to call method not from the class you have written, but from the List collection.

You should pass list as an argument.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.