title: How can I sort a List of Pair<String,Integer>?
body: <p>I have a list of commmons <code>Pair</code> that stores words and their frequency like the following</p>
  
  <pre><code>private List&lt;Pair&lt;String, Integer&gt;&gt; words = new ArrayList&lt;Pair&lt;String, Integer&gt;();
  </code></pre>
  
  <p>I am trying to sort it so that when I iterate over it to print the words, I want the words with the highest frequency to appear first.</p>
  
  <p>I tried playing around with implementing <code>Comparable</code> but most examples are not similar to using a list of Pairs</p>