Java Reference
In-Depth Information
See Also
Default methods in interfaces can be used to produce “mixins,” as described in Java Mixins:
Mixing in Methods .
Using Existing Code as Functional with Method References
Problem
You have existing code that matches a functional interface and want to use it without renam-
ing methods to match the interface name.
Solution
Use function references such as MyClass::myFunc or someObj::someFunc .
Discussion
The word “reference” is almost as overloaded in Java as the word “Session.” Consider:
▪ Ordinary objects are usually accessed with references.
▪ Reference Types such as WeakReference have defined semantics for garbage collection.
▪ And now, for something completely different, Java 8 lets you reference an individual
method.
Search WWH ::




Custom Search