title: using java streams to rank data in an array list
body: <p>I have an <code>ArrayList</code> containing strings for example list 1 may be a list of names:</p>
  
  <p><code>Bill, Bill, Bill, Henry, Sue, Sue</code></p>
  
  <p><strong>How do I use java streams to return the array as follows in ranked order (by occurrence)?</strong></p>
  
  <p><code>Bill, Bill, Bill, Sue, Sue, Henry</code></p>
  
  <p>It would also be great to know how to display the final ranking of 
  <code>Bill</code>, <code>Sue</code>, <code>Henry</code>. I have the following code:</p>
  
  <pre><code>System.out.println(
     name.stream()
         .sorted(Comparator.comparing(a-&gt;a))
         .collect(Collectors.toList())
  );
  </code></pre>
  
  <p>where name is the array.
  It works fine and arranges the array according to name but I also want to introduce ranking.</p>