There is a String.CASE_INSENSITIVE_ORDER
but why is there no String.CASE_SENSITIVE_ORDER
? Or is there such an order somewhere hidden?
Case-sensitive ordering is the default; ie String#compareTo
is case-sensitive. Therefore, there is no explicit Comparator
for it.
Collections.sort(myStringList); // case sensitive ("natural ordering")
Collections.sort(myStringList, String.CASE_INSENSITIVE_ORDER); // case insensitive
因为默认情况下String.CASE_SENSITIVE_ORDER
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.