java icon indicating copy to clipboard operation
java copied to clipboard

docs: Introduce new concept for TemporalAdjusters

Open rabestro opened this issue 9 months ago • 2 comments

pull request

Description

This PR introduces a new concept, "TemporalAdjusters", to the Java track's syllabus.

Motivation:

It has been observed (e.g., during mentoring for the Meetup exercise) that many students are unfamiliar with the java.time.temporal.TemporalAdjuster interface and the associated TemporalAdjusters utility class. This often leads to complex manual date calculations instead of leveraging these powerful and idiomatic standard library features.

Solution:

This PR adds a dedicated concept to explain TemporalAdjusters, covering:

  • What they are and why they are useful.
  • How to use them via the .with() method.
  • Common predefined adjusters provided by the TemporalAdjusters class (e.g., dayOfWeekInMonth, lastInMonth, nextOrSame).
  • The importance of immutability in java.time.

The following files have been created for this concept:

  • concepts/temporal-adjusters/about.md
  • concepts/temporal-adjusters/introduction.md
  • concepts/temporal-adjusters/links.json

UUID: cc7a06d1-ddb3-4722-88a5-f762254d664e

The concept has also been added to the track's main configuration file using the UUID above.

Goal:

By introducing this concept, we aim to guide students towards using TemporalAdjusters earlier, enabling them to write more idiomatic and robust solutions for date-related exercises.

Closes #2937


Reviewer Resources:

Track Policies

rabestro avatar May 04 '25 09:05 rabestro