Grokking Java Interview Questions
Vote

0% completed

​

Method References and Variable Capture

Method referenceLambda with the same result
Integer::parseInttext -> Integer.parseInt(text)
stock::getname -> stock.get(name)
String::lengthtext -> text.length()
ArrayList::new() -> new ArrayList<>()

A method reference is a short form for a lambda that only calls one existing method or constructor. The four rows look alike on the left, although each one supplies the arguments of the call in a different way.

The first question below names the four kinds

.....

.....

.....

Like the course? Get enrolled and start learning!

Reading Progress

0%


Vote for new content