JavaScript Required

We're sorry, but we doesn't work properly without JavaScript enabled.

Looking for an Expert Development Team? Take two weeks Trial! Try Now

What is Stream API in JDK 1.8?


Stream API in JDK

Stream API was introduced in JDK 1.8 release, for the sole purpose to ease the way to deal with collections of objects or we can say that stream of objects/elements stored in a Collection API implementation classes (LIST, MAP, etc.).

In this blog, Outsource java development team will discuss the intermediate operations/methods present in the Stream API its popular functions and operations.

Stream API intermediate methods:

This method is called the intermediate methods because the result or return type of this method is a Stream itself.

List of intermediate methods are:

Terminal operations/methods of Stream API

This method is called the terminal method because the return type of this method will be a non-stream element, such as primitive value, a collection, or no value at all.

One thing to note this method should be or can be called only after intermediate methods in precedence.

List of Terminal methods are:

Let’s understand each intermediate and terminal method in detail.


As the name suggests this intermediate method will filter the Stream elements based on the predicate passed. For example, you want to get only even numbers from the list of numbers you can easily do it using filter () and passing a predicate-argument to filter.

Predicate: It takes predicate reference as an argument. A predicate is a functional interface so we can also pass lambda expression here.

Code Examples:


Here we have seen that we can use stream API operations on a collection of elements or Arrays.

And we can get our desired result as we want.

Specific points to note

So finally stream API is the API that is introduced in java 1.8 to ease the outsourcing java development effort and get the desired result while dealing with a collection of elements and get the desired result with less effort and time.

Recent Blogs


NSS Note

Some of our clients