* If any of the three parts of this phone number is too small
* to fill up its field, the field is padded with leading zeros.
* For example, if the value of the line number is 123, the last
* four characters of the string representation will be "0123".
*/
- @Override public String toString() {
+ @Override
+ public String toString() {
return String.format("%03d-%03d-%04d",
areaCode, prefix, lineNum);
}
-// // Multiple-field Comparable with primitive fields (page 69)
-// public int compareTo(PhoneNumber pn) {
-// int result = Short.compare(areaCode, pn.areaCode);
-// if (result == 0) {
-// result = Short.compare(prefix, pn.prefix);
-// if (result == 0)
-// result = Short.compare(lineNum, pn.lineNum);
-// }
-// return result;
-// }
-
- // Comparable with comparator construction methods (page 70)
- private static final Comparator