This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
Hi all, Actually it is hard to explain here but i hope someone can give me an idea. I have several Strings and points for each String. (I'm trying to sort Strings according to their (search) points) I can not add points as key and Strings as value into TreeMap because it is possible that i can have same points for different Strings. How can i sort these collection of Strings according to their points? Thanks in advance.
Do you have the strings in an array or in a list? You can sort an array using Arrays.sort(...) and a list using Collections.sort(...). There are versions of those methods that take a Comparator. The Comparator is an object that decides the order during the sorting.
You could write your own implementation of interface Comparator and use it to sort the strings according to the order you desire.