From 9e9d80eb73db1ad49f52f00fb0cd2f50e4f9e144 Mon Sep 17 00:00:00 2001 From: Allen Chang Date: Wed, 24 Jul 2019 14:53:50 +0800 Subject: [PATCH] =?UTF-8?q?Update=2014.=20=E8=80=83=E8=99=91=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0Comparable=E6=8E=A5=E5=8F=A3.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit wrong snippets in `compareTo` method for the `PhoneNumber` class --- docs/notes/14. 考虑实现Comparable接口.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/notes/14. 考虑实现Comparable接口.md b/docs/notes/14. 考虑实现Comparable接口.md index 235035d..04aa80c 100644 --- a/docs/notes/14. 考虑实现Comparable接口.md +++ b/docs/notes/14. 考虑实现Comparable接口.md @@ -71,11 +71,11 @@ public final class CaseInsensitiveString ```java // Multiple-field `Comparable` with primitive fields public int compareTo(PhoneNumber pn) { - int result = [Short.compare(areaCode](http://Short.compare(areaCode), pn.areaCode); - if (result == 0) { - result = [Short.compare(prefix](http://Short.compare(prefix), pn.prefix); + int result = Short.compare(areaCode, pn.areaCode); + if (result == 0) { + result = Short.compare(prefix, pn.prefix); if (result == 0) - result = [Short.compare(lineNum](http://Short.compare(lineNum), pn.lineNum); + result = Short.compare(lineNum, pn.lineNum); } return result; }