Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Collections.sort in java using locale ????

 
Frank Jacobsen
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I Want to sort a list, with a danish locale, but when i try to sort like this it sort First "�" then "�" then "�" the exact wrong way, can i give a locale or how do i sort this list correct:





Frank
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Locale-specific String comparison can only be done using a Collator I think. If you get a Collator for a Danish Locale and have your SortTekstComparator test for ordering with Collator.compare(element1, element2) instead you should see the results you expect.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic