1 public int compareTo(Object o) { 2 Name n = (Name)o; 3 int lastCmp = 4 lastName.compareTo(n.lastName); 5 return 6 (lastCmp!=0 ? lastCmp : 7 firstName.compareTo(n.firstName)); 8 }
时间: 2024-11-10 00:34:10
1 public int compareTo(Object o) { 2 Name n = (Name)o; 3 int lastCmp = 4 lastName.compareTo(n.lastName); 5 return 6 (lastCmp!=0 ? lastCmp : 7 firstName.compareTo(n.firstName)); 8 }