관리 메뉴

개발용

[Collection] 정렬 본문

개발/JAVA

[Collection] 정렬

DeP 2017. 6. 5. 09:15

* Collection :: 사용자 정의 Object 정렬 :



Collections.sort([Collection], new Comparator<Map<String, Object>>() {

        @Override

        public int compare(Map<String, Object> obj1, Map<String, Object> obj2) {

            return (obj1.get([KEY_NAME])).compareTo(obj2.get([KEY_NAME]));

        }

});



: 두번째 파라미터로 비교 객체를 사용, compare메소드 override

'개발 > JAVA' 카테고리의 다른 글

eclipse 디버깅  (0) 2016.11.16
I/O  (0) 2016.11.16
제네릭 & 컬렉션  (0) 2016.11.16
자바가상머신의 메모리 분류방식  (0) 2016.11.16
예외처리 Exception  (0) 2016.11.10