mirror of
https://github.com/Snailclimb/JavaGuide
synced 2025-06-20 22:17:09 +08:00
Merge pull request #782 from Fuge2015/master
fix a bug: compareTo implement.
This commit is contained in:
commit
12fd03e771
@ -384,10 +384,11 @@ public class Person implements Comparable<Person> {
|
|||||||
// TODO Auto-generated method stub
|
// TODO Auto-generated method stub
|
||||||
if (this.age > o.getAge()) {
|
if (this.age > o.getAge()) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (this.age < o.getAge()) {
|
}
|
||||||
|
if (this.age < o.getAge()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return age;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user