public class Car {
private int maxSpeed;
public Car(int maxSpeed) {
this.maxSpeed = maxSpeed;
}
public int getMaxSpeed() {
return maxS
That is because the getMaxSpeed
method is a Function
.
Namely:
Comparator java.util.Comparator.comparing(
Function super Car, ? extends Integer> keyExtractor
)
Note
In order to reference getMaxSpeed
from an instance of Car
with the ::
idiom, you would have to declare a Car
method with signature: getMaxSpeed(Car car)
.