File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Sorting a Vector by a specific language? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Sorting a Vector by a specific language?" Watch "Sorting a Vector by a specific language?" New topic

Sorting a Vector by a specific language?

Niklas Junel

Joined: Dec 19, 2001
Posts: 11
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().
Dave Vick
Ranch Hand

Joined: May 10, 2001
Posts: 3244
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:
Sun Certified Programmer for the Java� 2 Platform

I agree. Here's the link:
subject: Sorting a Vector by a specific language?
It's not a secret anymore!