Sort list of strings - case insensitive
To sort list of strings ignoring the case
Using java library flag
Collections.sort(list, String.CASE_INSENSITIVE_ORDER);
By passing own comparator
Collections.sort(list, new Comparator<String>() {
@Override
public intcompare(String s1, String s2) {
returns1.compareToIgnoreCase(s2);
}
});
No comments:
Post a Comment