While thinking of the same problem I found out a Quartz Calendar. It has several problems like:
- It is an implementation part of a scheduling library - using it apart from all quartz just as a holiday calendar is a bit hackish.
- It has
getNextIncludeTime
method but no getPrevIncludeTime
.
- It has ugly and inconsistent API - AnnualCalendar has getter and setter that takes ArrayList, MonthlyCalendar has getter and setter that takes boolean[], both of them just expose class internals.
- It has some poorly documented issues - you can chain calendars, but order of chaining is important - DailyCalendar created on AnnualCalendar is OK, AnnualCalendar created on DailyCalendar will break (hang, I think).
Still it is the best thing I could find. So maybe just take the source code, fix what's wrong and add what's missing?