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.
i want to write an algorithm for sorting a HashMap in (iteration of each element)order. in fact, i have a big string (for example ,suppose the program reads a text file) and then i want to specify the 25 words which have the most iteration in file with the number of their iteration. i want to use a HashMap in this case. but when i want to implement the main algorithm, many ideas come to my mind which non of them are convenient.
If I understand it correctly, then the keys of the Map are strings, and the values are the frequencies in which they occur? In that case, you can use a SortedMap instead of a HashMap. It keeps the elements in the natural order of their keys if you obtain an iterator from it.
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