Parallel Streams intro || Stream processing Interview Questions and Answers Java 8
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
[ Ссылка ]
Course Description Video :
[ Ссылка ]
Java 8 Interview Questions Complete Playlist :
[ Ссылка ]
Udemy Course of Code Decode on Microservice k8s AWS CICD link:
[ Ссылка ]
Course Description Video :
[ Ссылка ]
___________________________________________________________________________
CodeGym -
___________________________________________________________________________
Discount Code : CODEDECODE
Contact the support team to use the discount code for a 30 % discount on monthly subscriptions
Email id: support@codegym.cc
How to access CodeGym :
[ Ссылка ]
___________________________________________________________________________
Stream Processing -
___________________________________________________________________________
Collect -
If we want to collect elements of stream after filtering or mapping and add them to the required collection then use collect method.
Count -
If we want to count how many elements are there in collection that satisfy given condition then use collect method.
sorted -
If we want to sort elements inside a stream use this sorted() method.
We can sort based on default natural sorting order
If we want to sort using customized sorting order then use comparator.
Comparator
If we want to sort using customized sorting order then use comparator.
Min Max-
Min(Comparator) will return the minimum value based on the defined comparator
Max(Comparator) will return the maximum value based on the defined comparator
Foreach
forEach() is a method .
All methods that we saw till now returned something, like min max value, sorted collection, etc
This method does not return anything.
Rather This method takes lambda expression as argument and apply that lambda expression to each element present in that stream.
toArray-
of() -
Stream concept is not applicable just for the collections it’s also applicable for “ANY GROUP OF VALUE”.
Even for arrays you can use stream.
Stream . Of() this method can take any group of values and convert them to stream so that multiple stream operations can be applied to it.
Parallel Stream
Java Parallel Streams came into picture after java 1.8.
Its meant to utilize multiple cores of processor.
Till Now our java code has 1 stream of processing where it executes sequentially.
But when you use parallel streams, we divide code into multiple streams that executes parallely , on separate cores and final result is the outcome of individual cores outcomes combined.
Sequential VS Parallel Streams.
-------------------------------------------------------------------------------------------------------------------------------------
Code Decode Playlists
Most Asked Core Java Interview Questions and Answers : [ Ссылка ]
Advance Java Interview Questions and Answers : [ Ссылка ]
Java 8 Interview Questions and Answers : [ Ссылка ]
Hibernate Interview Questions and Answers : [ Ссылка ]
Spring Boot Interview Questions and Answers : [ Ссылка ]
Angular Playlist : [ Ссылка ]
GIT : [ Ссылка ]
-------------------------------------------------------------------------------------------------------------------------------------
Subscriber and Follow Code Decode
Subscriber Code Decode : [ Ссылка ]
Linkedin : [ Ссылка ]
Instagram : [ Ссылка ]
--------------------------------------------------------------------------------------------------------------------------------------
#java8 #parallelStreamJava8 #Java8InterviewQuestion
Ещё видео!