{"id":2787,"date":"2025-12-24T10:00:14","date_gmt":"2025-12-24T15:00:14","guid":{"rendered":"https:\/\/www.mymiller.name\/wordpress\/?p=2787"},"modified":"2025-12-24T10:00:14","modified_gmt":"2025-12-24T15:00:14","slug":"calutils","status":"publish","type":"post","link":"https:\/\/www.mymiller.name\/wordpress\/java_extra\/calutils\/","title":{"rendered":"CalUtils"},"content":{"rendered":"\n<p>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.  <\/p>\n\n\n\n<div class=\"wp-block-coblocks-gist\"><script src=\"https:\/\/gist.github.com\/Ghost-Programmer\/8ae0f515316b9f675239bb25578dd09f.js\"><\/script><noscript><a href=\"https:\/\/gist.github.com\/Ghost-Programmer\/8ae0f515316b9f675239bb25578dd09f\">View this gist on GitHub<\/a><\/noscript><\/div>\n\n\n\n<p>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.<\/p>\n\n\n\n<p>Each return a List&lt;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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2788,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[457],"tags":[69],"series":[],"class_list":["post-2787","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java_extra","tag-java-2"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2020\/04\/january-2290045_640.jpg?fit=640%2C396&ssl=1","jetpack-related-posts":[{"id":1088,"url":"https:\/\/www.mymiller.name\/wordpress\/sametime\/new-java-security-baseline-means-sametime\/","url_meta":{"origin":2787,"position":0},"title":"New Java Security Baseline and what it means to Sametime","author":"Jeffery Miller","date":"April 23, 2014","format":false,"excerpt":"On April 15, 2014 Oracle has released Java 7 Update 55, with this update the security baseline was moved to Java 7 Update 55. \u00a0For Sametime users this means when they download a Java applet they will be prompted with a security dialog. \u00a0To resolve this issue Sametime users will\u2026","rel":"","context":"In &quot;Sametime&quot;","block_context":{"text":"Sametime","link":"https:\/\/www.mymiller.name\/wordpress\/category\/sametime\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2014\/02\/docview.gif?fit=502%2C316&ssl=1&resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2062,"url":"https:\/\/www.mymiller.name\/wordpress\/java_extra\/advancedcalendar\/","url_meta":{"origin":2787,"position":1},"title":"AdvancedCalendar &#8211; java.util.Calendar java.util.Date java.text.SimpleDateFormat","author":"Jeffery Miller","date":"April 20, 2026","format":false,"excerpt":"Every get tired of converting from Dates to Calendars and then need to use SimpleDateFormat to output it as a String? \u00a0How about parsing a string and getting a Date object? \u00a0Personally after a single project that had several \u00a0date time stamps that required manipulation I grew very tired of\u2026","rel":"","context":"In &quot;Java Extras&quot;","block_context":{"text":"Java Extras","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_extra\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2017\/02\/calendar-1255953_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2017\/02\/calendar-1255953_640.jpg?fit=640%2C426&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2017\/02\/calendar-1255953_640.jpg?fit=640%2C426&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3451,"url":"https:\/\/www.mymiller.name\/wordpress\/java\/streamlining-java-project-development-with-gradle-a-comprehensive-configuration-guide\/","url_meta":{"origin":2787,"position":2},"title":"Streamlining Java Project Development with Gradle: A Comprehensive Configuration Guide","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Setting up a Gradle project with subprojects involves a thoughtful configuration to ensure a smooth development process. In this article, we'll walk through the step-by-step process of configuring a Gradle project to incorporate essential tools and plugins such as Spotless, Javadoc, Dependency Check, License Info, SonarLint, JaCoCo, and Test Reporting.\u2026","rel":"","context":"In &quot;JAVA&quot;","block_context":{"text":"JAVA","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/spreadsheet-309088_640.png?fit=640%2C626&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/spreadsheet-309088_640.png?fit=640%2C626&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/04\/spreadsheet-309088_640.png?fit=640%2C626&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3366,"url":"https:\/\/www.mymiller.name\/wordpress\/java_new_features\/pattern-matching-for-switch\/","url_meta":{"origin":2787,"position":3},"title":"Pattern Matching for Switch","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Pattern matching for switch statements is a new feature introduced in Java 16 that allows for more concise and expressive switch statements. This feature enables developers to use pattern matching to test expressions against multiple patterns, making it easier to write cleaner and more readable code. In this blog article,\u2026","rel":"","context":"In &quot;Java New Features&quot;","block_context":{"text":"Java New Features","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_new_features\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/network-cable-g9e6b10ea9_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/network-cable-g9e6b10ea9_640.jpg?fit=640%2C427&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2023\/06\/network-cable-g9e6b10ea9_640.jpg?fit=640%2C427&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3148,"url":"https:\/\/www.mymiller.name\/wordpress\/java_tips\/java-tips-part-2\/","url_meta":{"origin":2787,"position":4},"title":"Java Tips Part 2","author":"Jeffery Miller","date":"December 24, 2025","format":false,"excerpt":"Continuing my Java Tips from experience that I have learned from code reviews to different programming tasks. Tip 6: Don't call .toString() on slf4j logging calls. So if you're following my other tips and using the formatting option of the logging messages like this: list.parallelStream().filter(item -> !item.contains(\"BOB\")).forEach(item -> logger.debug(\"Item: {}\u2026","rel":"","context":"In &quot;Java Tips&quot;","block_context":{"text":"Java Tips","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_tips\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2021\/12\/sam-dan-truong-rF4kuvgHhU-unsplash-scaled-e1640791434235.jpg?fit=640%2C427&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2021\/12\/sam-dan-truong-rF4kuvgHhU-unsplash-scaled-e1640791434235.jpg?fit=640%2C427&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2021\/12\/sam-dan-truong-rF4kuvgHhU-unsplash-scaled-e1640791434235.jpg?fit=640%2C427&ssl=1&resize=525%2C300 1.5x"},"classes":[]},{"id":3737,"url":"https:\/\/www.mymiller.name\/wordpress\/java_new_features\/java-23-is-here-exploring-the-full-release-and-incubator-features\/","url_meta":{"origin":2787,"position":5},"title":"Java 23 is Here: Exploring the Full Release and Incubator Features","author":"Jeffery Miller","date":"December 23, 2025","format":false,"excerpt":"Java 23 arrived in September 2023 with a range of new features and improvements. While it may not be a Long-Term Support (LTS) release, it offers some exciting additions worth exploring. In this blog post, we\u2019ll dive into the full release features of Java 23, providing clear explanations and practical\u2026","rel":"","context":"In &quot;Java New Features&quot;","block_context":{"text":"Java New Features","link":"https:\/\/www.mymiller.name\/wordpress\/category\/java_new_features\/"},"img":{"alt_text":"","src":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/immune-defense-1359197_1280-jpg.avif","width":350,"height":200,"srcset":"https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/immune-defense-1359197_1280-jpg.avif 1x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/immune-defense-1359197_1280-jpg.avif 1.5x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/immune-defense-1359197_1280-jpg.avif 2x, https:\/\/www.mymiller.name\/wordpress\/wp-content\/uploads\/2024\/10\/immune-defense-1359197_1280-jpg.avif 3x"},"classes":[]}],"jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2787","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/comments?post=2787"}],"version-history":[{"count":1,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2787\/revisions"}],"predecessor-version":[{"id":2789,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/posts\/2787\/revisions\/2789"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media\/2788"}],"wp:attachment":[{"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/media?parent=2787"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/categories?post=2787"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/tags?post=2787"},{"taxonomy":"series","embeddable":true,"href":"https:\/\/www.mymiller.name\/wordpress\/wp-json\/wp\/v2\/series?post=2787"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}