Created
March 14, 2011 14:49
-
-
Save KirkWylie/869236 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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