Skip to main content

Binary Tree Traversals in Java: Inorder, Preorder, Postorder and Level Order (Recursive and Iterative)

Binary tree traversal in Java on one numbered nine-node tree: recursive and iterative inorder, preorder and postorder with stack dry-run tables, one-stack postorder, Morris traversal, level order and zigzag with a queue, height, an O(n) versus O(n squared) diameter comparison by counted visits, a real StackOverflowError on a one-million-node skewed tree, and exam questions with answers.

sun.misc.Unsafe Memory Access Is Going Away: Find and Fix It in Your Dependencies

JDK 25 already prints a warning when a library calls sun.misc.Unsafe memory-access methods, and JEP 471 plans for them to throw and then disappear. What each --sun-misc-unsafe-memory-access value does on JDK 25, how jdeps, a bytecode scan and JFR find the callers in real jars (Netty, Guava, Kryo, Hadoop, Cassandra, Protobuf and more), and CAS, off-heap and byte[] code migrated to VarHandle and the FFM API with a before/after equivalence test.

Load Testing Spring Boot with Gatling’s Java DSL (and How It Compares to k6)

A tiny Spring Boot 4.1.2 app with a deliberate 160-requests-per-second limit, load tested with Gatling 3.16.0's Java DSL: scenarios, feeders and checks, open versus closed injection (and why a closed model hides the overload), an incrementUsersPerSec staircase that finds the knee between 150 and 180 users per second, global assertions that fail the Maven build, and what the Gatling report does and does not contain. The same test is then run in k6 v2.3.0 on the same app and compared.

Custom Annotations and Annotation Processors in Java: Generate Code at Compile Time

Retention, targets and meta-annotations, runtime reflection versus compile-time processing, and a complete @GenerateBuilder annotation processor: Filer, Messager, compile errors with real javac output, in-memory tests with javax.tools, and the JDK 23+ trap where a processor on the classpath silently stops running (reproduced on JDK 25).

CommandLineRunner vs ApplicationRunner vs ApplicationReadyEvent in Spring Boot 4

Which Spring Boot startup hook should you use? A beginner-first comparison on Spring Boot 4.1.2 of CommandLineRunner, ApplicationRunner, an ApplicationReadyEvent listener and SmartLifecycle, with the exact order they run in, how @Order sorts both runner kinds in one list (and why unordered ties come out differently on different JVMs), what happens when a runner or a ready-event listener throws, how a blocking runner holds readiness at 503 while the port is already open, and what tests run. Every figure comes from a companion project whose test suite writes the transcripts.

MapStruct with Spring Boot 4 and Java Records: DTO Mapping Done Right

A beginner-first walk through MapStruct on Spring Boot 4.1.2 with Java records as DTOs: how the generated mapper works, nested and collection mapping, null-value strategies, updating existing objects, and what @AfterMapping, @BeforeMapping and @ObjectFactory really do when the target is an immutable record. Every figure comes out of a companion project whose 19 tests write the transcripts, plus the compiler's own error messages and an honestly labelled, indicative comparison with hand-written code and Dozer. Includes surprises: @MappingTarget on a record compiles to an empty method, and JDK 23+ no longer runs a processor that is only on the classpath.

Hibernate ID Generation: IDENTITY vs SEQUENCE vs UUID v7, and Why Batch Inserts Break

Hibernate 7.4.14 primary keys, measured: IDENTITY turns JDBC batching off silently (10,000 inserts became 10,000 single executes), a pooled SEQUENCE needed 400 round trips, and a sequence whose INCREMENT BY disagrees with allocationSize produced negative and duplicate ids. On UUIDs, the common premise is half wrong: Style.TIME is a version-1-flagged id with a constant IP/JVM half, while real RFC 9562 version 7 ships as Style.VERSION_7 from Hibernate 7.0.0. Includes order_inserts, AUTO across six dialects, an H2 index-size comparison (PostgreSQL could not be run), and the Spring Data SELECT-before-INSERT on assigned ids.