At most one LocalDate per month in a list I'm implementing argument check in a method where one parameter is a List of LocalDate objects (from Joda-Time). I want to make sure that List contains at most one LocalDate per month. 

public List&lt;LocalDate&gt; generateAllDates(List&lt;LocalDate&gt; firstYearDates, ...) { }


Thus, for example

Arrays.asList(
    new LocalDate(2012, 3, 25),
    new LocalDate(2012, 4, 30),
    new LocalDate(2013, 3, 26)
)


would be an illegal argument because there are two dates whose month is March.

Currently I have something like this (making use of Guava's Multimap):

Multimap&lt;Integer, LocalDate&gt; monthToDates = HashMultimap.create();
for (LocalDate date : firstYearDates) {
    monthToDates.put(date.getMonthOfYear(), date);
}
for (Integer i : monthToDates.keySet()) {
    if (monthToDates.get(i).size() &gt; 1) {
        throw new IllegalArgumentException(
            "firstYearDates must contain at most one entry per month");
    }
}


Question is, how would you simplify that? Using any API features of JDK 1.6, Guava or Joda-Time is fine.
Bit late but there is Guava built-in method for that - Maps.uniqueIndex - given:

List&lt;LocalDate&gt; dates = Arrays.asList(
     new LocalDate(2012,3,25), new LocalDate(2012,4,30), new LocalDate(2013,3,26);


with JDK 8:

Maps.uniqueIndex(dates, LocalDate::getMonthOfYear);


or with JDK &lt;7:

Maps.uniqueIndex(dates, new Function&lt;LocalDate, Integer&gt;() {
    @Override
    public Integer apply(final LocalDate date) {
      return date.getMonthOfYear();
    }
});


It will throw 

java.lang.IllegalArgumentException: duplicate key: 3


in this example.