This post originated from an RSS feed registered with Java Buzz
by Arpit Mandliya.
Original Post: Difference between map and flatMap in java
Feed Title: Java tutorial for beginners
Feed URL: http://feeds.feedburner.com/arpitmandliyasblog
Feed Description: A blog about java programming language and its frameworks
In this post, we will see the difference between map and flatMap in java.I have already covered Stream’s map and flatMap methodsĀ in previous articles. As you might know, Stream’s map and flatMap method both can be applied on Stream<T> and return Stream<R> as output. The actual difference is, map operation produces one output value for one input value but flatMap operation produces zero or more number of values for each input value. Let’s understand with the help of the simple example. Stream map vs flatMap You have list of String and you want to make them uppercase, in this