i have an Array List with Following values
ArrayList [Admin,Readonly,CSR,adminuser,user,customer]
when i used
Collections.s
You can do with custom Comparator.
Try this:
// list containing String objects
List list = new ArrayList<>();
// call sort() with list and Comparator which
// compares String objects ignoring case
Collections.sort(list, new Comparator(){
@Override
public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2);
}
});
You will need to pass Comparator
instance in Collections.sort()
method which compares String
objects ignoring case.