How to Write a Generic Class and Method in Java (Java 21)
Write a generic class, generic methods, bounded types and wildcards in Java 21 by building a parcel shelf, with 21 passing checks and the compiler errors.
Write a generic class, generic methods, bounded types and wildcards in Java 21 by building a parcel shelf, with 21 passing checks and the compiler errors.
Flatten students, courses and assignments with flatMap, flatMapToInt, Optional.stream and mapMulti on Java 21. 22 checks, forced errors and the fixes included.
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.
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.