I am playing around in Java 8. How can I return a method reference?
I am able to return a lambda but not the method reference.
My attempts:
p
I would like to add some points.
You can't instantiate unbounded type instance.
List> list = new ArrayList>();
Second, as Tunaki mentioned, you can't make references to new MyObject::staticMethod
when you make method references
The other thing is, forEach(Consumer
(Terminal operation for pipeline streams) doesn't return anything. It only eats whatever we feed it.
-Hope this may help :)