Tagged articles
Collectors
23 articles · Page 1 of 1
A hands-on guide demonstrating how Java Stream API reduces a real-world reporting task from 78 lines to 17, covering deduplication strategies, multi-level sorting pitfalls, grouping with downstream collectors, and one-pass statistics using IntSummaryStatistics.
CollectorsComparatorIntSummaryStatistics
0 likes · 23 min read

The article explains the core functions of Java’s Collectors, reveals their underlying implementation, and demonstrates how custom Collectors can handle complex aggregation scenarios—such as multi‑metric calculations, stateful reductions, and performance‑critical tasks—using a single‑pass, parallel‑compatible approach, while comparing against standard groupingBy compositions.
CollectorsJavaStream
0 likes · 10 min read

This article explains the key differences between Java's Stream toList() method introduced in JDK 16, which returns an unmodifiable list, and the traditional collect(Collectors.toList()) which yields a mutable ArrayList, illustrating behavior with code examples, performance considerations, and practical usage tips.
CollectorsImmutable ListJDK16
0 likes · 8 min read

Learn how to effectively use Java's Stream API to convert a list of User objects into a Map, handle duplicate keys by providing a merge function, and avoid common pitfalls like IllegalStateException and NullPointerException using Optional and concise code examples.
CollectorsDuplicate KeyJava
0 likes · 6 min read

This article explores Java Stream's advanced capabilities, including multi‑level grouping and partitioning with Collectors, parallel stream performance tips, creation of infinite streams, stream concatenation and transformation, short‑circuit operations, primitive stream optimizations, and how to build custom collectors and streams, all illustrated with concrete code examples and step‑by‑step demonstrations.
CollectorsInfinite StreamJava
0 likes · 12 min read

This article explains how to convert a list of Java User objects into a Map using Stream's toMap collector, handling duplicate keys and null values with merge functions and Optional, and compares alternative approaches including manual HashMap population.
BackendCollectorsJava
0 likes · 6 min read

This article explains how to convert a list of Java objects into a Map using Stream's toMap collector, addresses duplicate key exceptions, demonstrates providing a merge function, handling null values with Optional, and compares alternative approaches such as manual loops, offering complete code examples.
CollectorsDuplicate KeyStream
0 likes · 7 min read

This article explains Java 8's lambda expressions, functional interfaces, and the Stream API, demonstrating how immutable values and functions enable concise data processing through lazy and eager evaluation, with practical code examples covering predicates, consumers, mapping, filtering, grouping, and reduction.
CollectorsFunctional InterfacesJava
0 likes · 12 min read

This article introduces Java 8's lambda expressions, functional interfaces, and the Stream API, explaining key concepts such as lazy and eager evaluation, and demonstrates common stream operations like collect, filter, map, flatMap, max/min, count, and reduce with concrete code examples.
BackendCollectorsFunctional Interfaces
0 likes · 16 min read

This article compares Java's Stream.toList(), Collectors.toList(), and Collectors.toUnmodifiableList() by explaining their differences, showing benchmark code, presenting performance results for both 1,000 and 10,000 element streams, and concluding which method offers superior speed and efficiency.
CollectorsStreambenchmark
0 likes · 8 min read

This article introduces Java 8's functional interfaces and lambda expressions, explains immutable values and function composition, demonstrates common stream operations such as collect, filter, map, flatMap, max/min, count, and reduce, and shows how to use advanced collectors like groupingBy, partitioningBy, and joining with practical code examples.
CollectorsFunctional InterfaceJava
0 likes · 17 min read

This article explains the difference between Java's Stream.toList() introduced in Java 16, which returns an unmodifiable list, and the traditional Collectors.toList() used in Java 8 that produces a mutable list, and shows how to achieve immutability across versions.
CollectorsImmutable ListJava
0 likes · 5 min read

This article provides a hands‑on guide to Java 8 Stream Collectors, demonstrating how to use toList, toSet, toCollection, toMap, summingInt, joining, groupingBy, partitioningBy and related collectors with clear code examples and output results.
BackendCollectorsDataAggregation
0 likes · 11 min read

This article explains how to use IntelliJ IDEA's Live Template feature to create shortcuts for common Java Stream collector operations such as toList, toSet, joining, and groupingBy, improving code readability and productivity when migrating large codebases to the Stream API.
CollectorsIntelliJ IDEAJava
0 likes · 6 min read

This article explains Java 8's lambda expressions and functional interfaces, demonstrates common Stream operations such as filter, map, flatMap, collect, max/min, count and reduce, and shows how to use advanced collectors for grouping, partitioning and joining with clear code examples.
CollectorsFunctional InterfacesJava
0 likes · 12 min read

This article explains why HashMap cannot preserve entry order, introduces LinkedHashMap to maintain insertion order, and provides both classic and lambda‑based Java solutions—including detailed code snippets—to sort a Map by its values efficiently.
CollectorsJavaLinkedHashMap
0 likes · 8 min read

This article introduces Java 8's lambda expressions and functional interfaces, demonstrates custom functional interfaces, and explains how to use the Stream API with operations such as collect, filter, map, flatMap, max/min, count, reduce, partitioningBy, groupingBy, and joining, providing code examples throughout.
CollectorsFunctional InterfacesJava
0 likes · 13 min read

This article explains how to upgrade Java code to use lambda expressions and the Stream API, highlights the inconvenience of repeatedly writing collect(Collectors.toList()) calls, and shows how IntelliJ IDEA's Live Templates can automate common collector patterns to boost productivity.
CollectorsIntelliJ IDEAJava
0 likes · 6 min read

This article explains Java 8's functional interfaces, lambda expressions, method references, lazy versus eager evaluation, and demonstrates how to use the Stream API—including collect, filter, map, flatMap, max/min, count, reduce, and various collectors—to write concise, expressive code for processing collections.
CollectorsFunctional InterfacesJava
0 likes · 15 min read

This article explains Java 8's lambda expressions and functional interfaces, demonstrates common Stream operations such as filter, map, flatMap, max/min, count, and reduce, and shows how to use built‑in collectors like toList, partitioningBy, groupingBy, and joining with practical code examples.
CollectorsFunctional InterfacesJava8
0 likes · 16 min read

This article introduces Java 8’s key functional programming features—lambda expressions, functional interfaces, and the Stream API—explaining concepts such as lazy and eager evaluation, and demonstrating common operations like filter, map, flatMap, collect, reduce, and grouping with clear code examples.
CollectorsFunctional InterfacesJava 8
0 likes · 15 min read

This article introduces Java 8's lambda expressions and functional interfaces, demonstrates their usage with examples, and explains how to leverage the Stream API—including operations like filter, map, flatMap, reduce, collect, and grouping—to process collections efficiently.
CollectorsFunctional InterfacesJava
0 likes · 15 min read

The article discusses Java 8's Stream API limitations, especially the lack of a toList() method, and shows how IntelliJ IDEA's Live Templates can create shortcuts for common collectors, improving code readability and developer productivity.
CollectorsIntelliJJava
0 likes · 7 min read
