sorted

요소가 최종 처리되기 전에 중간 단계에서 요소를 정렬해서 최종 처리 순서를 변경할 수 있다. sorted() => 객체의 Comparable 구현 방법에 따라 정렬 sorted(Comparator) => 객체를 주어진 Comparator에 따라 정렬 정렬과 관련해서 기존에 사용하고 있던 Worker 클래스를 변형하였다. Comparable 인터페이스를 구현하여, 나이(age)기준으로 오름차순으로 정렬할 수 있게 변경하였다. public class Worker implements Comparable{ private String name; private int age; public Worker(String name, int age) { super(); this.name = name; this.age = ag..
깡냉쓰
'sorted' 태그의 글 목록