Java Internationalization Rules. It says to replace
s1.compareTo(s)==0
with
Collator.compare(s1,s2)<0
why <0?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Based on the Javadoc, it is a typo – should be
==:This is for the
Stringoverload ofCollator.compare(as the linked example comparesStrings), but the general version of the method behaves the same way.The article you referred indirectly links to the corresponding page of the Java Tutorial, which describes the behaviour consistently with the above.