Skip to content

how-to-tutorials

46 Posts

How to Filter and Transform a List with Java Streams

Turn a for loop into a Java streams pipeline that filters and transforms a list. Build a gradebook in Java 21, trip every classic mistake, and check it all.

How to Use CountDownLatch, CyclicBarrier and Semaphore

Build a stock-sync job in plain Java 21 and use CountDownLatch, CyclicBarrier and Semaphore each where it fits, with runnable checks and the traps I forced.

How to Implement the Observer Pattern in Java (Java 21)

Build a stock-alert system with the observer pattern in Java 21: a thread-safe subject, lambda listeners, safe unsubscribe, and 16 checks that prove it works.

How to Use flatMap in Java to Flatten Nested Lists

Flatten students, courses and assignments with flatMap, flatMapToInt, Optional.stream and mapMulti on Java 21. 22 checks, forced errors and the fixes included.