Originally published at www.gunnargissel.com
Mapping is how to convert one type of object to another with a stream. Say you have a set of Fruit a...
For further actions, you may consider blocking this person and/or reporting abuse
Good article and thank you for sharing.
For those not aware it is also possible to use a method reference for the first example:
This is just a more succinct syntax for invoking the
#getName
method on each and every instance ofFruit
in the stream. As such even though it may appear to be invoked on the class it is not a static method.Also a small API thing - it is
Collectors#toList
not#asList
(and#toSet
).Thanks. I now fully understand this mapping thing