[1] 캡슐화를 위반한다.
//기존
Comparator<Apple> byWeight = new Comparator<Apple>() {
@Override
public int compare(Apple a1, Apple a2) {
return Integer.compare(a1.getWeight(), a2.getWeight());
}
};
//람다
Comparator<Apple> byWeight =
(Apple a1, Apple a2) -> Integer.compare(a1.getWeight(), a2.getWeight());