728x90 Collections.sort()2 [Java] Arrays.sort()와 Collections.sort()에 대해서 자세히 알아보자! 안녕하세요 coding-knowjam입니다. 오늘은 정렬할 때 사용하는 대표적인 메서드 Arrays.sort()와 Collections.sort()에 대해 알아보겠습니다. 1. Arrays.sort() 1.1 API 문서 (Java 8) 문서 URL : https://docs.oracle.com/javase/8/docs/api/ API문서를 살펴보면 여러 가지 타입에 따라 사용할 수 있도록 overloading 된 sort() 메서드를 볼 수 있습니다. 그로 인해 우리는 Arrays.sort()에 char, int, boolean 등 과 같은 primitve(기본형) 타입과 reference(참조) 타입의 배열을 인자로 전달해서 사용할 수 있습니다. (배열만 사용 가능) 메서드에 매개변수로 Compara.. Java 2021. 3. 13. [Java] Comparable / Comparator에 대해서 알아보자! (feat. 백준알고리즘-1181) 안녕하세요 coding-knowjam입니다. 오늘은 Comparable, Comparator 인터페이스에 대해서 알아보겠습니다. 1. Comparable Interface 1.1 API 문서 Java 8 API 문서에서 Comparable Interface는 다음과 같이 설명하고 있습니다. (API 문서 : https://docs.oracle.com/javase/8/docs/api/) This interface imposes a total ordering on the objects of each class that implements it. This ordering is referred to as the class's natural ordering, and the class's compareTo meth.. Java 2021. 1. 14. 이전 1 다음 728x90