Method references are shorthand for lambdas that just call an existing method.
List<String> names = List.of("ava", "ben", "cara");
names.stream()
.map(String::toUpperCase)
.forEach(System.out::println);
AVA
BEN
CARA
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-07-26