Season 01
18 article(s) in this season
-
06 Nov 2024
💊 #8: Eager and lazy strategies compared with Optional and Mono (WebFlux)
Differences between orElse and orElseGet on Optional, switchIfEmpty with and without defer on Mono: eager vs lazy strategies and when to pick each one to avoid side-effects.
-
28 Oct 2024
💊 #7: Backpressure with WebFlux – the hookOnSubscribe and hookOnNext methods
How to control the flow of data between publisher and subscriber with BaseSubscriber, hookOnSubscribe and hookOnNext: batched requests to avoid overloads.
-
06 Oct 2024
💊 #6: Building a small Mac app with ChatGPT on a boring afternoon
A boring afternoon, ChatGPT and AppleScript: from automatically creating Photos albums on macOS to the app icon, without writing almost anything by hand.
-
21 Sep 2024
💊 #5: Mocking static and final fields with reflection and Unsafe (Java > 11)
How to use reflection + sun.misc.Unsafe to override a private static final Supplier in tests, bypassing the JVM's restrictions on immutable fields.
-
03 Sep 2024
💊 #4: Handling a Mono<Mono<Void>> in WebFlux – the subscribe method
Two ways to handle a Mono<Mono<Void>> in WebFlux: explicit subscribe() and flatMap + then().
-
29 Aug 2024
💊 #3: Optimising your code with WebFlux – the zipWhen method
Replacing flatMap + Mono.zip with zipWhen to chain two dependent operations in WebFlux: more concise code, with a Tuple2 as output.
-
22 Aug 2024
💊 #2: Handling heterogeneous lists with the Stream API
Two approaches to extracting typed sub-lists from a List<Object>: a for loop with instanceof vs the Stream API with filter/map. Trade-offs in efficiency, readability and maintainability.
-
20 Aug 2024
💊 #1: Optimising your code with WebFlux – the doOnNext method
How to use doOnNext in WebFlux for side-effects (updates, logging, etc.) without breaking the data-flow, improving readability and maintainability.