클래스에서 Comparable
인터페이스를 구현하고 싶습니다.Java에서 비교 가능한 인터페이스 구현
public Myclass implements Comparable<MyClass>{
public int compareTo(MyClass o){
//impl here
}
}
옵션 2 :
public Myclass implements Comparable{
public int compareTo(Object o){
//check if o instance of my class
//impl here
}
}