In this video, we discussed all the stream intermediate operations with programs in Java 8. This is the only video to learn stream operations. This will be really helpful to crack the interview.
Operations Covered:
filter
map
flatMap
sorted
limit
skip
peek
distinct
Program Covered:
filter:
Filter names with length greater than 3
Filter employees older than 30
map:
Multiply each number by 2 using map
Extract the names of employees using map
flatMap:
Flatten the list of fruits
Find all the fruit names that start with A from List of List
sorted:
Sort numbers in natural order (ascending)
Sort names in reverse order
limit:
Get the first 3 elements using limit
skip:
Skip the first 3 elements
Filter even numbers and skip the first 2
distinct:
Removing Duplicate Strings
Remove duplicate person from List
peek:
Debugging the stream with peek