This is just a more succinct syntax for invoking the #getName method on each and every instance of Fruit 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).
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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
).