Map Vs Flat Map | Top Java 8 Coding Interview Question and Answers | Code Decode | Java 8 features

preview_player
Показать описание
In this video of map vs flatmap we have covered top java 8 coding interview questions for experienced along with answers i.e Map vs flatmap

Udemy Course of Code Decode on Microservice k8s AWS CICD link:

Course Description Video :

In this video of java 8 interview question and answer of code decode we have explained the difference between map and flatmap

map vs flatmap is a very important questions in terms of java 8 interview questions and answers for experienced and freshers

map vs flatmap comes under top java 8 interview questions and answers

we have also explained the internal working of flatmap

How Map works in Java 8

It applies a function on each element of Stream and stores return value into new Stream.

The map operation takes a Function, which is called for each value in the input stream and produces one result value, which is sent to the output stream.

How Flat Map works in java 8

Is the combination of a map and a flat operation

This means you first apply the map function and then flattens the result.

The key difference is the function used by map operation returns a Stream of values or a list of values rather than a single value, that's why we need flattening. When you flat a Stream of Stream, it gets converted into Stream of values.

To understand what flattening a stream consists in, consider a structure like [ [1,2,3],[4,5,6],[7,8,9] ] which has "two levels". It's basically a big List containing three more List. Flattening this means transforming it in a "one level" structure e.g. [ 1,2,3,4,5,6,7,8,9 ] i.e. just one list.

In short,
Before flattening - Stream of List of Integer
After flattening - Stream of Integer

---------------------------------------------------------------------------------------------------------------------------------------------------

-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode

--------------------------------------------------------------------------------------------------------------------------------------

#mapvsflatmap #java8interviewquestions #codedecode
Рекомендации по теме
Комментарии
Автор

Hi, Thank you so much for the Java8 videos. This helped a lot to crack my interviews. Also can you please do video on how to resolve memory leak issues in java as it was the most commonly asked question in managerial round.

lakshmipg
Автор

Great and simple explanation of a complex concept. Hats off.

shivamagarwal
Автор

Thanks for making Java8 easy for all of us . Awesome explanaition 👍

VikasKumar-uksk
Автор

Superb explanation of java8 concepts, Keep continuing

g.prakashreddy
Автор

I thought learning Java 8 will be difficult but I played your playlist & that's it.
Thanks for sharing your knowledge with everyone in simplified manner.
God Bless :-)

GauravSharma-upgs
Автор

I have been sharing your videos bcoz these are so great!
Thanks.

RishiRaj-exwb
Автор

Thank you so much for your explanation.

MrAsgar
Автор

Thanks a lot for detailed explaination.

pankajdogra
Автор

Nice video, can i have this program in comment or description???

mdmanzerimam
Автор

Hello mam.
I have 8 months of experience.
Superb explanation of all the concepts I have been following your videos and I am more confident in the interviews but recently I faced very difficulty in project questions ( end to end spring Boot application ).
I struggled to answer the interviews so can u start a new video series for interview questions on the project.

minusmagic
Автор

Can you also make vedio on oauth authentication in spring boot, csrf,sql injection attacks ?

rutujagurnule
Автор

Best programming related Channel ever.

PankajKumar-ejdt
Автор

You are a precious gem !! I feel more confident now to give interviews.

thwik
Автор

Hi ma'am, can you pls share all your ppt's or docs ?

hasitgotanymeaning
Автор

Ma'am can u please create a video on Remote method invocation? I have gone through many channels but haven't been successful in understanding it..seeing the way you explain, I am pretty much hopeful you can teach it quite well. Please 🥺

manognajoshik
Автор

Nice explanation madam.. can you please do one video about spring boot get the MySQL table data without model clas.

villagevibess
Автор

So you are collecting it as a set and thats the reason for getting unique values as result right? Not because you use flatmap. When flatmap is used, we'd get a single list, but with all the values including duplicates?

sanalsz
Автор

Hi, don't add video suggestion boxes appear at the end of the video. Sometimes, it affects the material / code, which is being shown on the screen. It ruins the thing (course material). If you want, you add them with (i) symbol at the top right corner. Thanks.

saumilvachheta
Автор

Can you please make a video on @bean in details in spring or spring boot..

modern_mirror
Автор

I think in this video, speed is little bit fast. Not easy to concentrate on the topic. Before upto this video everything was awesome. It's just an enhancement not a bug

manindersingh