Skip to content

Instantly share code, notes, and snippets.

@KirkWylie
Created March 14, 2011 14:49
Show Gist options
  • Save KirkWylie/869236 to your computer and use it in GitHub Desktop.
Save KirkWylie/869236 to your computer and use it in GitHub Desktop.
class NextQuarterAdjuster implements DateAdjuster {
private final Set<MonthOfYear> _futureQuarters =
Sets.newHashSet(MonthOfYear.MARCH,
MonthOfYear.JUNE,
MonthOfYear.SEPTEMBER,
MonthOfYear.DECEMBER);
@Override
public LocalDate adjustDate(LocalDate date) {
LocalDate result = date;
do {
result = result.plusMonths(1);
} while (!_futureQuarters.contains(result.getMonthOfYear()));
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment