How to Implement the Decorator Pattern in Java (Java 21)
Build a currency-rates client and bolt on logging, retries, caching and validation with the decorator pattern in Java 21. Full code, order traps, 25 checks.
Build a currency-rates client and bolt on logging, retries, caching and validation with the decorator pattern in Java 21. Full code, order traps, 25 checks.
How to read environment variables and system properties in Java 21: one Settings class, a clear precedence rule, typed values, masked secrets and 16 checks.
Build a student-grade report in Java 21 with arrow switches, yield, guarded patterns and case null. Full code, 39 checks, and seven compile errors forced.
Write equals() and hashCode() you can trust: a parcel tracker built with plain Java 21, four classic bugs forced on purpose, and 16 checks that prove the fix.
Build a ticket SLA tracker in Java 21 that parses, adds and prints times across DST changes with LocalDate, LocalDateTime and ZonedDateTime.
How to use ProcessBuilder in Java 21: run a command, read stdout and stderr, feed stdin, set a timeout and kill a stuck child, with 14 checks and 5 traps.
Build an immutable Recipe class in Java 21: final class, final fields, defensive copies and with-ers, plus the leaks a final field alone lets through.
Build a parcel-tracking state machine in Java 21 with enums and a transition table, add a guard for failed deliveries, and prove the rules with 19 checks.
Build an invoice calculator in Java 21 with BigDecimal: exact money, half-even rounding, tax and discounts, and a bill split that never loses a cent.
Build a retry helper in plain Java 21: exponential backoff, full jitter, Retry-After, a time budget and tests, run against a deliberately flaky HTTP server.