How to use Collectors.groupingBy() in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.groupingBy() in Java 8. If you would like to learn about Java 8 Stream operations.Please check out this link.I request you to have a basic understanding of Java 8 features and stream operations as a prerequisite.Please have a look at Java 8 complete guide. So let us […]

How to use Collectors.partitioningBy() in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.partitioningBy() in Java 8. If you would like to learn about Java 8 Stream operations.Please check out this link. Collectors.partitioningBy() in Java 8 Collectors.partitioningBy() is a useful operation in Java stream which allows us to partition/group the elements in the stream based on a given predicate/boolean expression.Collectors.partitioningBy() […]

Java Stream collect() operation with examples

Welcome to Java 8 series. In this tutorial, you will learn about java stream collect() operation with examples. Stream collect() is a reduction operation performed on the stream of elements. It applies a certain function on the stream of elements to generate the final output. Stream collect() is mainly used for, converting the stream of elements into a collection interface such as […]

How to use Collectors averagingDouble()/averagingInt/averagingLong in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors averagingDouble()/averagingInt/averagingLong in Java 8 If you would like to learn about Java 8 Stream operations. Please check out this link. Collectors.averagingDouble()/averagingInt/averagingLong in Java 8 is mainly used to identify mean of the stream of elements. If there is scenario or use case to find the […]

How to use Collectors.summarizingDouble() in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.summarizingDouble() in Java 8 If you would like to learn about Java 8 Stream operations. Please check out this link. Collectors.summarizingDouble() Collectors.summarizingDouble() in Java 8 is a useful and wonderful operation of Stream collect(). It provides us the statistics of the stream of elements. It returns […]

How to use Collectors.summarizingLong() in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.summarizingLong() in Java 8 If you would like to learn about Java 8 Stream operations. Please check out this link. Collectors.summarizingLong() Collectors.summarizingLong() in Java 8 is a useful and wonderful operation of Stream collect(). It provides us the statistics of the stream of elements. It returns […]

How to use Collectors.summarizingInt() in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.summarizingInt() in Java 8 If you would like to learn about Java 8 Stream operations.Please check out this link. Collectors.summarizingInt() Collectors.summarizingInt() in Java 8 is a useful and wonderful operation of Stream collect().It provides us the statistics of the stream of elements. It returns a class […]

Collectors.summingInt()/summingLong()/summingDouble()

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.summingInt()/summingLong()/summingDouble()  in Java 8. If you would like to learn about Java 8 Stream operations.Please check out this link. Collectors.summingInt()/summingLong()/summingDouble()  is used in Java 8 streams to sum the elements of the Stream into a single value. Each operation produces the sum value of the stream […]

How to use Collectors.counting() in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.counting() in Java 8. If you would like to learn about Java 8 Stream operations.Please check out this link. Collectors.counting() in Java 8 allows us to count the number of elements in the stream and provide the output as Long. Collectors.counting() Syntax public static <T> Collector<T,?,Long> […]

How to use Collectors.toCollection in Java 8

Welcome to Java 8 series. In this tutorial, you will learn about how to use Collectors.toCollection in Java 8. If you would like to learn about Java 8 Stream operations.Please check out this link. Collectors.toCollection in Java 8 is used in Stream concepts to collect the stream of elements in a collection and collection should be of type  java.util.Collection. We can […]