Default Methods


Idioms and Techniques

Design Rationale

Advanced Questions

What is the syntax for instance method references?

The syntax for referring to static methods has been described. There are two ways of referring to instance methods. One is strictly analogous to the static case, replacing the form ReferenceType::Identifier with ObjectReference::Identifier. For example, the forEach method could be used to pass each element from a collection into an instance function for processing:

pointList.forEach(System.out::print); […]