SHARE
TWEET

Untitled

a guest Jun 27th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public with sharing class Dataclass {
  2. ...    
  3. try {
  4.         for(DarexSort__c sortobj : sortAdRec){
  5.             String sortString = sortobj.Unsifie__c;
  6.             List<String> sortList = sortString.split(',');
  7.             List<Integer> intList = new List<Integer>();
  8.             for(String s : sortList){
  9.                 intList.add(Integer.valueOf(s));
  10.             }
  11.             intList.sortStatic(); // Error here
  12.             sortString = string.join(intList,',');
  13.             sortobj.Sofie__c = sortString;
  14.             sortRec.add(sortobj);
  15.         }    
  16.         update sortRec;  
  17.         sortRec.clear();  
  18. ...
  19. }
  20.  
  21. public class Sortclass{
  22.   private List<Integer> mNumbers;
  23.   private Integer mNumber;
  24.   public static void sortStatic(List<Integer> values){
  25.         (new Quicksort()).sort(values);
  26.   }
  27.   public void sort(List<Integer> values) {
  28.     if (values ==null || values.size()==0){
  29.       return;
  30.     }
  31.     this.mNumbers = values;
  32.     mNumber = values.size();
  33.     quicksort(0, mNumber - 1);
  34.   }
  35.   private void quicksort(Integer low, Integer high) {
  36.     Integer i = low, j = high;
  37.     Integer pivot = mNumbers[low + (high-low)/2];
  38.     while (i <= j) {
  39.       while (mNumbers[i] < pivot) {
  40.         i++;
  41.       }
  42.       while (mNumbers[j] > pivot) {
  43.         j--;
  44.       }
  45.       if (i <= j) {
  46.         exchange(i, j);
  47.         i++;
  48.         j--;
  49.       }
  50.     }
  51.     // Recursion
  52.     if (low < j)
  53.       quicksort(low, j);
  54.     if (i < high)
  55.       quicksort(i, high);
  56.   }
  57.   private void exchange(Integer i, Integer j) {
  58.     Integer temp = mNumbers[i];
  59.     mNumbers[i] = mNumbers[j];
  60.     mNumbers[j] = temp;
  61.   }
  62. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top