Well, you can just make your Name class implement Comparable, and then use the Collections.sort() method.
I assume you're implementing your own sort method as an exercise though. Anyway, there are several things you could consider wrong. Your method
1) is destructive, it destroys the list you pass into it. This is not considered very wanted behavior.
2) discards names that are 'greater' than "zzz, zzz", and inserts this name instead.
3) creates new instances for each name in the list, and adds them to the new list. Why not add the names directly?
4) uses a do-while loop. Don't use do-while loops. Use while loops instead.
Your Name class implements equals() wrongly, and on top of that, it doesn't implement hashCode(). Read the contract for Object.equals() and Object.hashCode().
Joined: May 08, 2006
HI stephan, thanks a lot for your comments....your reviews are very helpful
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com