The map() operation in the stream applies the given lambda function(i - > i * i) as an argument on the elements of the stream.
The count method returns the value 5.
To Print the square value of each value in the stream, we used intermediate method peek().
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.