Java/API

[Java API] Interface Comparator<T>

정코드 2019. 3. 29. 20:28


Interface Comparator<T>


Type Parameters:

T - the type of objects that may be compared by this comparator




@FunctionalInterface

public interface Comparator<T>


객체의 일부 Collection에 순서를 부과하는 비교 함수입니다. sort 순서를 제어할 수 있습니다.


Method


int compare(T o1, T o2)


o1와 o2를 비교합니다. o1 > o2이면 양수, o1 < o2이면 음수, o1 == o2이면 0을 반환합니다.