📜  java compareto jdei stackoverflow - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:02.664000             🧑  作者: Mango

代码示例1
public int compareTo(Jedi jedi){
    int result = this.name.compareTo(jedi.getName());
    if(result == 0){
        result = this.age > jedi.age ? 1 : this.age < jedi.age ? -1 : 0;
    }
    return result;
}