• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Sorting a Vector by a specific language?

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm trying to sort a Vector with the static method sort() in Collections. The problem is that I want to sort it according to the Swedish language. It's possible to send an object of Collator with the sort-method (set to Locale swedish), but it doesn't seem to work. In my vector I have put objects of a class of persons (home-made class) and I want to sort it by last name, then by first name. Does my person's class need a specific method? It already have equals(),compare(Object o,Object o2) and hashCode().
------------------
 
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Niklas
Please dont cross post to multple forums. Many of the visitors tot he ranch read and answer questions in more than forum and cross posting to more than one may cause them to think you're rude and not answer your question - ot they may think you'll get an answer in another forum and ignore other posts of th same question.
I am closing this thread since you already received an answer here: http://www.javaranch.com/ubb/Forum1/HTML/002443.html
------------------
Dave
Sun Certified Programmer for the Java� 2 Platform
 
girl power ... turns out to be about a hundred watts. But they seriuosly don't like being connected to the grid. Tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic