
익명 클래스Collections.sort(words, new Comparator() { public int compare(String s1, String s2) { return Integer.compare(s1.length(), s2.length()) }});람다Collections.sort(words, (s1, s2) -> Integer.compare(s1.length(), s2.length()));람다는 함수나 익명 클래스와 개념은 비슷하지만 코드는 훨씬 간결하다. 람다를 사용할 때는 타입을 명시해야하는 코드가 더 명확할 때만 제외하고는, 람다의 모든 매개변수 타입은 생략하자.람다 자리에 비교자 생성 메서드를 사용하면 코드를 더 간결하게 만들 수 있다.Collection..