title: Sort ArrayList based on a on object property
body: <p>I have a <code>ArrayList&lt;CustomObject&gt; myFinalList = new ArrayList&lt;CustomObject&gt;();</code>
  The list has a ojbect property "NumberOfLikes" for each entry in the list. "NumberOfLikes" are String values.</p>
  
  <p>I have derived these values into an array like so:-</p>
  
  <pre><code>ArrayList&lt;String&gt; numberOfLikes = new ArrayList&lt;String&gt;();
  
          for(int j =0; j&lt;myFinalList.size(); j++)
          {
              String likes = myFinalList.get(j).getNewsLikes();
              numberOfLikes.add(likes);
          }
  
  
          numberofLikesArray=  numberOfLikes.toArray(new String[numberOfLikes.size()]);
  
      int[] numberofLikesArrayInt = new int[numberofLikesArray.length];
  
      for (int n = 0; n &lt; numberofLikesArray.length; n++) 
      {
          numberofLikesArrayInt[n] = Integer.parseInt(numberofLikesArray[n]);
      }
      Arrays.sort(numberofLikesArrayInt);
      ArrayList&lt;Integer&gt; intAarrylistlikes = new ArrayList&lt;Integer&gt;();
      for (int i = 0; i &lt; numberofLikesArrayInt.length; i++) 
      {
          intAarrylistlikes.add(numberofLikesArrayInt[i]);
      }
      Collections.reverse(intAarrylistlikes);
      numberofLikesArrayInt = convertIntegers(intAarrylistlikes);
      numberofLikesArray = Arrays.toString(numberofLikesArrayInt).split("[\\[\\]]")[1].split(", ");
  
      for (int i = 0; i &lt; numberofLikesArray.length; i++) 
      {
          companyNewsList = Lists.newArrayList(Collections2.filter(myFinalList, new ArticleFilter2(numberofLikesArray[i])));
      }
  </code></pre>
  
  <p>ArticleFilter2.java</p>
  
  <pre><code>public class ArticleFilter2 implements Predicate&lt;News&gt;
  {
      private final Pattern pattern;
  
      public ArticleFilter2(final String regex)
      {
          pattern = Pattern.compile(regex);
      }
  
      @Override
      public boolean apply(final CustomObject input)
      {
          return pattern.matcher(input.getLikes()).find();
      }
  }
  </code></pre>
  
  <p>Now this array consists of the "NumberOfLikes" in descending order. Now I want to create another ArrayList which sorts the "MyFinalList" according to these values ie:- item having the maximum likes should appear first.</p>
  
  <p>How can I do it?</p>