1, when using the org.apache.commons.lang3.StringUtils tool class, I looked at the source code of equals and equalsIgnoreCase to see how to ignore case comparison, but found that the content of the comparison between the two methods is basically the same, who can explain what is the essential difference between the source code of the two methods?
2. The jar package I use is commons-lang3-3.6.jar. The source code of the two methods is as follows:
public static boolean equalsIgnoreCase(CharSequence str1, CharSequence str2) {
if (str1 != null && str2 != null) {
if (str1 == str2) {
return true;
} else {
return str1.length() != str2.length() ? false : CharSequenceUtils.regionMatches(str1, true, 0, str2, 0, str1.length());
}
} else {
return str1 == str2;
}
}