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 int
compare(String s1, String s2) {
return
s1.compareToIgnoreCase(s2);
}
});
No comments:
Post a Comment