Mon. Aug 8th, 2022

Recently had a need to break things out over a given date range into month-long increments. I found a solution that did this, however, I was not happy with it using the old Calendar() API. I set about creating a new implementation for this based on LocalDate.

Now you can see I create a simple util class implementing applyByMonth(), applyByWeek(), and applyByDay(). Each of these take a start/end date, to specify the range. The applyByMonth() and applyByWeek() each take BiFunction Functional interface to pass in the start/end date of the month/week for processing, and expects a return. While applyByDay() is a Function Functional interface for passing in the date of that day.

Each return a List<R> then for you to handle your data further on. Allowing you to generate the data as you see fit, with the information you need.

By Jeffery Miller

I am known for being able to quickly decipher difficult problems to assist development teams in producing a solution. I have been called upon to be the Team Lead for multiple large-scale projects. I have a keen interest in learning new technologies, always ready for a new challenge.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: