daily pastebin goal
82%
SHARE
TWEET

Untitled

a guest Aug 15th, 2018 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public String sortByName() {
  2.         String min;
  3.         int index = 0;
  4.         int x = reg.size();
  5.         sb = new StringBuilder();               //Lagrar utsökningsresultatet,
  6.         boolean help[] = new boolean[x];        // x = index för arrayn = antal "personer +1"
  7.  
  8.         for(int i = 0; i<=(x-1); i++){
  9.             min = "zzzzzzzzzzzzzzzzzzzzzzzzzzz";    //= stort värde
  10.             for(int k = 0; k<=(x-1); k++) {
  11.                 String d = reg.get(k).getName();            // värde på d.=> tillfällig variabel,
  12.  
  13.                 if( help[k] == false && d.toLowerCase().compareTo(min.toLowerCase()) < 0) {
  14.                     index = k;
  15.                     min = d;
  16.                 }
  17.             }
  18.             sb.append(reg.get(index).getName() + "\n " + reg.get(index).getDate() + "\n");
  19.             help[index] = true;
  20.         }
  21.         return sb.toString();           // stringbuilder till en vanlig string
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