I am looking for a Java class where I can specify a set of date rules, such as “every 3rd sunday” and “the first occurrence of a monday every second month”. I want to be able to get something like an infinite iterator out of it (.next() would return the next date matching the rules set).
I think I’d be able to build it myself – but calendars are a hassle, and it feels like something similar should exist already. I hate being the one to reinvent a crappier wheel.
Is anyone aware of something like this? I have been looking at JODA, and it seems to lay the groundwork for it, but does not appear to give the full functionality I want..
I don’t think there’s any readily made iterators for joda-time or Java Calendar API for that matter, however with joda it’s so easy that you should just go with it. For example after re-familiarizing myself with joda after a few months pause I made this in about 10 minutes:
Joda Time is awesome 🙂