title: How to sort ArrayList<myobject> on the basis of myobject's properties
body: <p>I want to sort some objects which are in an ArrayList on the basis of the objects properties.
  the object has:</p>
  
  <pre><code>public class Minterm
  
  {
      String minTerm;
      char flagTick;
      String minTermDerive;
      int groupNo;
      String adjGroup;
      static int MaxLiterals;
  </code></pre>
  
  <p>then i have this in the main method:</p>
  
  <pre><code>ArrayList&lt;Minterm&gt; column =new  ArrayList&lt;Minterm&gt;();
  </code></pre>
  
  <p>then i add some objects of type <code>Minterm</code> in the list. but at the end i want to organise them and sort them on the member variable <code>groupNo</code>(Ascending order).</p>
  
  <p>i searched and came up with the comparable and comparator interfaces that i tried but didnt succeed. is there any other method to do this? or am i doing the comparator implemnting wrong. </p>
  
  <p><strong>EDIT :</strong>
  Following is the code i wrote for Comparator. Please confirm if it will sort in ascending?</p>
  
  <pre><code>package backEnd;
  
  import java.util.Comparator;
  
  public class Comp implements Comparator&lt;Minterm&gt;
  {
          @Override
          public int compare(Minterm a, Minterm b) 
          {
              return a.getgroupOne().compareTo(b.getgroupOne());
          }
  }
  </code></pre>
  
  <p>i run it as:</p>
  
  <pre><code>Collections.sort(column , new Comp());
  </code></pre>
  
  <p>seems to be working fine. but i dont have a sound understanding of it.
  Please confirm if it will sort in ascending?</p>