Skip to content

how-to-tutorials

46 Posts

How to Convert Date, Instant, LocalDateTime in Java 21

Convert java.util.Date, Timestamp, Calendar and epoch millis to Instant and LocalDateTime in Java 21, with zone-safe code and checks on a parcel tracker.

How to Use var in Java Without Hurting Readability

Learn how to use var in Java 10+ on a parcel tracker: where it helps, the diamond and ternary traps, 12 compiler errors forced on purpose, and 11 checks.

How to Use ConcurrentHashMap in Java: A Stock Service

Build a thread-safe stock service in Java 21 with ConcurrentHashMap: merge, compute, computeIfAbsent, and the get-then-put trap that lost 300,000 updates.