Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sorting in GWT based on String

Tags:

java

sorting

gwt

I need to sort a List based on MyDto.name in client-side GWT code. Currently I am trying to do this...

Collections.sort(_myDtos, new Comparator<MyDto>() {

        @Override
        public int compare(MyDto o1, MyDto o2) {
        return o1.getName().compareTo(o2.getName());
        }
});

Unfortunately the sorting is not what I was expecting as anything in upper-case is before lower-case. For example ESP comes before aESP.

like image 263
benstpierre Avatar asked Dec 08 '22 04:12

benstpierre


1 Answers

This is the bad boy you want: String.CASE_INSENSITIVE_ORDER

like image 157
Tom Avatar answered Dec 09 '22 17:12

Tom