Java 8 Stream map example

In this tutorial Java 8 Stream map example, we will show you few Java 8 map examples to demonstrate the use of Streams map() and can be used with mapToInt(), collect() and average(). map() returns a Stream instance processed by a given Function. Here, We need to pass Function instance as lambda expression.

Let’s dig deeper via examples:

Uppercase a list of Strings

Simple Java example to convert a list of Strings to upper case

Output

List of objects -> List of String

Fetch all the name values from a list of the People objects.

Output

List of objects -> List of other objects

This example shows you the way to convert a list of People objects into a list of PeopleExt objects.

Output
Java 8 Stream map example

That’s all about Java 8 Stream map example.

Reference
Java 8 Stream
Processing Data with Java SE 8 Streams

Download complete source code, click link below

Java8StreamMapExample.zip (1 download)

Leave a Comment

*

Please share it if you found this useful
Hide Buttons