How to pass parameter in Stream.map method
1 answer
How does
Object::toString
it work and how does it work?
It is called a method reference , in which you tell it to use an existing method definition toString
(from the class Object
) for the methodmap
, instead of having you explicitly call obj -> obj.toString()
within the method map
.
I suggest you take a look here and understand how method references work in Java8.
+1
source to share