title: How can I sort an arraylist without using collections.sort()?
body: <p>I have been looking for a while for a way to sort an arraylist without using collections.sort as my own logic is flawed and I have been having a lot of trouble. </p>
  
  <p>I need to sort it in a way that I can use a method I created that basically does what collections.swap does in order to completely sort an arraylist.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>public static void mySort(ArrayList&lt;Double&gt; sort){
  
      int min = 0;
      int i;
      int j = 0;
          for(i = 0; i &lt; sort.size() - 1; i++) {
              min = i;
              mySwap(sort, j ,min);
  
              for(j = 0; j &lt; sort.size() -1;j++){
                  if(j &lt; min ){
                      min = j;
                  }
              }
      }
  }
  
  public static void mySwap(ArrayList&lt;Double&gt; a, int x, int y){
  
      double temp = a.get(x);
      a.set(x,a.get(y));
      a.set(y,temp);
  }
  </code></pre>
  
  <p>I have been having a lot of trouble of with this. Sorry if it is a question is that harming the community.</p>