Skip to content

title: Passing Methods Around by Name description: Java method references with :: — static methods, methods on an object, methods on the parameter and constructor references, and when a lambda must stay.


Passing Methods Around by Name

☕ Java 17

Many lambdas only pass their work on to a method that already exists. A method reference (::) points Java straight at that method instead. Here you'll learn the four shapes of method references, how to read each one, and when a lambda has to stay.

In this series

# Page Reading time
1 The :: shortcut, static and object methods 3 min
2 Methods on the parameter, and constructors 3 min
3 Lab: filling and filtering the catalog 4 min

🎓 OCP 1Z0-829 candidates: exam traps and practice questions (optional)

Prerequisites: The One-Method Contract Behind Every Lambda.

Code: Java17_Part_8_Functional_Programming on GitHub