Tag Archives: java-stream

In this article, we will learn Java Stream Filter API. We will cover, 1. How stream filter API works. 2. Filter by Object Properties. 3.… Read More
A Collection is an in-memory data structure, which holds all the values that the data structure currently has. Every element in the Collection has to… Read More
Prerequisite: Streams in Java A stream in Java is a sequence of objects which operates on a data source such as an array or a… Read More
Introduced in Java 8, the Stream API is used to process collections of objects. A stream is a sequence of objects that supports various methods… Read More
Given a stream containing some elements, the task is to find the duplicate elements in this stream in Java. Examples: Input: Stream = {5, 13,… Read More
Given a value N, the task is to create a List having this value N in a single line in Java using Stream. Examples: Input:… Read More
In this article, a static map is created and initialised in Java using Stream. Static Map in Java A static map is a map which… Read More
The ofNullable(T) method returns a sequential Stream containing a single element if this stream is non-null otherwise method returns an empty Stream. It helps to… Read More
The dropWhile(java.util.function.Predicate) method returns two different types of stream depending upon whether the stream is ordered or not. If the stream is ordered then a… Read More
The iterate(T, java.util.function.Predicate, java.util.function.UnaryOperator) method allows us to iterate stream elements till the specified condition. This method returns a sequential ordered Stream produced by iterative… Read More
The takeWhile(java.util.function.Predicate) method returns a stream of the remaining elements of this stream after taken the longest prefix of elements that match the given predicate… Read More
The Stream API, introduced in Java 8, it is used to process collections of objects. Stream is a sequence of objects, that supports many different… Read More
Given a Stream, the task is to convert this Stream into ArrayList in Java 8. Examples: Input: Stream: [1, 2, 3, 4, 5] Output: ArrayList:… Read More
Given the task is to generate an infinite sequential unordered stream of double in Java. This can be done in following ways: Using DoubleStream.iterate(): Using… Read More
Given the task is to generate an infinite sequential unordered stream of integers in Java. Recommended: Please try your approach on {IDE} first, before moving… Read More