February 2014
Intermediate to advanced
160 pages
4h 59m
English
| | people.stream() |
| | .sorted(Person::ageDifference) |
We can replace a lambda expression with a method reference if it directly routes the first parameter as a target of a method call, and the remaining parameters as this method’s arguments. The preceding sample code is equivalent to this:
| | people.stream() |
| | .sorted((person1, person2) -> person1.ageDifference(person2)) |