Java 8 Stream API: A Comprehensive Guide with 20 Practical Examples for Collection Processing
The Java 8 release marked a significant milestone in the language's evolution. Among its most impactful features is the Stream API, which works seamlessly with Lambda expressions to revolutionize how we manipulate collections. This combination provides elegant, functional-style operations that significantly reduce boilerplate code while improvi ...
Posted on Sun, 26 Jul 2026 17:01:46 +0000 by craigtolputt
Java Runtime Memory Behavior and Core Language Mechanics Explained
Object Arrays and Heap Allocation
When declaring an object array like String[] arr = new String[5], the JVM allocates a contiguous block in the heap to store five references, not five String objects. Each reference is initialized to null. The array object itself — including its length metadata and reference slots — resides entirely on the heap. ...
Posted on Sun, 12 Jul 2026 16:15:27 +0000 by dvonj
Advanced Java Programming - Part 2
Use cases for immutable collections:
If data should not be modified, defensively copy it into an immutable collection
When collections are passed to untrusted libraries, immutable forms provide safety
List<String> list = List.of("Zhang San", "Li Si", "Wang Wu", "Zhao Liu");
Map<String, String&g ...
Posted on Sat, 16 May 2026 06:29:28 +0000 by Strings