0

This is my Friend object:

public class Friend {

public String firstname;
public String lastname;
...

I want to sort a Friend ArrayList based on the firstname field, and to take account accents:

ArrayList<Friend> mFriends;
...

// Sort friend by firstname
Collections.sort(mFriends, new Comparator<Friend>() {
        @Override
        public int compare(Friend o1, Friend o2) {
            return o1.firstname.compareTo(o2.firstname);
        }
});

So, how can I add the accent condition?

Termininja
  • 6,620
  • 12
  • 48
  • 49
anthony
  • 7,653
  • 8
  • 49
  • 101

1 Answers1

0

I am not clear, But Collator enables to compare with accents.
see: How to compare non english characters with accents

Community
  • 1
  • 1
nshmura
  • 5,940
  • 3
  • 27
  • 46