title: Obtaining unique values from a list
body: <p>I know there are classes like Hashset that can remove duplicates but I'm not sure if I can apply it to my case.
  I have a list of dates, separated into month and day respectively.</p>
  
  <pre><code>private static List&lt;MonthDay&gt; Dates() {
      List&lt;MonthDay&gt; dates = new ArrayList &lt;MonthDay&gt;();
      dates.add(MonthDay.of(JAN, 1));
      dates.add(MonthDay.of(JAN, 2));
      dates.add(MonthDay.of(FEB, 3));
      dates.add(MonthDay.of(MAR, 1)); 
      return dates;
  }
  </code></pre>
  
  <p>I've also created a method to return lists of specified dates.</p>
  
  <pre><code>private static List&lt;MonthDay&gt; Month(Month month) {
      List&lt;MonthDay&gt; monthList = new ArrayList&lt;&gt;();
       for (MonthDay m : Dates()) {
          if (m.getMonth().equals(month)) {
              monthList.add(m);
           }
      }
      return monthList;
  }
  </code></pre>
  
  <p>Now, I want to have a method to check whether my month is unique or not (i.e., if there is only one date that falls in that month), and then return a list of the dates containing the unique months. </p>
  
  <p>e.g. FEB and MAR are unique months in the list, so the output I should get is </p>
  
  <blockquote>
    <p>[--02-03, --03-01]</p>
  </blockquote>
  
  <p>How do I go about doing so?</p>