title: Java How can ArrayList<String> be sorted/ordered by index?
body: <p>So i have this ArrayList:</p>
  
  <pre><code>list.get(0) == "love"  
  list.get(1) == "foo"  
  list.get(2) == "make"  
  list.get(3) == "links"
  </code></pre>
  
  <p>What i want is:</p>
  
  <pre><code>list.get(0) == "links"  
  list.get(1) == "make"  
  list.get(2) == "foo"  
  list.get(3) == "love"
  </code></pre>
  
  <p>I have tried this but not working:</p>
  
  <pre><code>public static void orderDescending(final ArrayList&lt;String&gt; list){
      Collections.sort(list, new Comparator&lt;String&gt;() {
          public int compare(String s1, String s2) {
              Integer i1 = list.indexOf(s1);
              Integer i2 = list.indexOf(s2);
              return i1.compareTo(i2);
          }
      });
   }
  </code></pre>