Collectors mapping in Java

Collectors mapping in Java is a static method in the Collectors class. In this post, we will learn about the mapping method in Collectors.

August 23, 2021

Immutable Collections Using Collectors

In Java 10, the Collectors has static utility methods to return collectors which collect the stream elements into an immutable collection.

February 22, 2021

Collectors collectingAndThen

Collectors collectingAndThen returns a new Collector that adapts a passed Collector to perform a finishing transformation function.

February 1, 2021

Collectors Joining in Java 8

Collectors.joining returns a Collector which concatenates the stream elements separated by a delimiter, prefix and suffix in encounter order.

November 30, 2020

Collectors minBy and maxBy

Collectors minBy and maxBy return a Collector that produces the minimal and maximal element according to a given Comparator

August 3, 2020

Collectors partitioningBy in Java

The Collectors partitioningBy method in the Collectors class groups the elements of a stream by a predicate and an optional downstream collector

June 22, 2020

Collectors filtering, flatMapping and teeing

In this post, we will learn about the new methods added to the Java Collectors from Java 9 to 11 (Collectors filtering, flatMapping and teeing).

June 1, 2020

Collectors toMap Duplicate Key

This post shows the Collectors toMap duplicate key exception and the changes made in Java 9 to improve the exception message to contain the value of the key.

December 2, 2019

Collectors groupingBy with Examples

The Collectors groupingBy is a static utility method in the Collectors class. It is used to group the stream elements by a key. In this blog post, we will look at the Collectors groupingBy with examples.

October 6, 2019

Java 8 Collectors toMap with Examples

In this blog post, I will demonstrate the Java 8 Collectors.toMap method with examples and how it’s used to fold a stream into a map.

September 29, 2019