Lambda: A static method reference matches the functional interface's parameter list directly

A reference to a static method such as Math::max or Integer::parseInt maps its parameters directly onto the functional interface's parameters, with no implicit receiver involved.

Code
BiFunction<Integer, Integer, Integer> max = Math::max;
System.out.println("max.apply(3, 9) = " + max.apply(3, 9));
Function<String, Integer> parse = Integer::parseInt;
System.out.println("parse.apply(\"123\") = " + parse.apply("123"));
Output
max.apply(3, 9) = 9
parse.apply("123") = 123
Advertisement
More in JAVA

Run this yourself in the Online Java Compiler, spin up a live REST API in the API Sandbox, or practise with Java interview questions.

Published 2026-09-27

© Java Coding Hub · About · Contact · Privacy · Terms