equals(…) and equalsIgnoreCase(…)

后端 未结 7 928
遇见更好的自我
遇见更好的自我 2021-01-01 19:44

Why do we have equals() and equalsIgnoreCase() as two different methods, when equals() could have been overloaded with a special

7条回答
  •  滥情空心
    2021-01-01 20:13

    It's absolutely possible to do what you are suggesting but the language designers chose to go the other way and hence we have equalsIgnoreCase(otherString) instead of say equals(otherString, StringConstants.IGNORE_CASE) or equals(otherString, true).

提交回复
热议问题