Posts related to tag: stream


Stream reduce() vs. collect() in Java 8

In Java 8, the Stream.reduce() and Stream.collect() methods are used for performing reduction operations, but they are intended for different […] Continue reading »

Java Stream peek() Method Example

In this blog, we’ll explore the Java 8 Stream peek() method, understanding its purpose and demonstrating how it can be […] Continue reading »

Java 8– Find first and all smallest string in List

Using the Java 8 Stream API min method, you can find the first and all smallest strings from a List. […] Continue reading »

Java- Print all duplicate elements from a List

In Java, we have multiple ways to find duplicate elements in a List. We can loop through the List and […] Continue reading »

Java- Find the element in the List having maximum value

In Java 8, Stream API’s max method returns the maximum element of this stream according to the provided Comparator and […] Continue reading »

How to sort Map by Key or Value in Java 8

A Map can also be sorted with stream.sorted() method in Java 8. We can sort the Map based on its […] Continue reading »

Java 8 – How to sort Set with stream.sorted()

In this quick tutorial, we’ll learn how to sort Set in Java 8. stream.sorted() is a predefined method of Stream […] Continue reading »

How to sort list in Java 8

In Java 8, the elements of a list are sorted by calling stream.sorted() method of Stream interface. As we know, […] Continue reading »

Java 8 Stream- Sum of List of Integers

Java 8 Stream interface provides mapToInt() method to convert a stream integers into a IntStream object and upon calling sum() method […] Continue reading »

How to iterate Enum in Java

This guide walks you through how to iterate Enum in Java/Java 8. .values() method of an enum class return an […] Continue reading »

Java 8- How to replace word in a File using Stream

On this page, you will learn how to find and replace words in a file using Java Stream. Java introduced […] Continue reading »