Skip to content

Instantly share code, notes, and snippets.

@jpgough
Last active January 3, 2016 09:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jpgough/8444213 to your computer and use it in GitHub Desktop.
Save jpgough/8444213 to your computer and use it in GitHub Desktop.
An implementation to find the last days in each month for a specific year.
public List<DayOfWeek> lastDaysOfMonthsInYear(int year) {
return Stream.of(Month.values())
.map(month -> LocalDate.now().withYear(year)
.with(month)
.with(TemporalAdjusters.lastDayOfMonth())
.getDayOfWeek())
.collect(Collectors.toList());
}
@jpgough
Copy link
Author

jpgough commented Jan 16, 2014

Improved based on this implementation: https://gist.github.com/RichardWarburton/8446478

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment