Edit More detailed Description of the function:
I have a HashSet filled with a specific object named Symbol. A specific function iterates through all Symbols. The function specify the energy cost of every single Symbol and return this. I want to make a new Set/Map and save the Symbols in it, ordered by this energy cost.
The next algorithm takes the Symbol with the biggest energy cost and put it in another List which is limited in cases of energy cost. When this List is full, the algorithm ends.
What should I use to save the energy cost and the Symbol? I should be able to get the energy cost and the Symbol.
I thought about a SortedMap and order it through the guava.collection like here:
https://stackoverflow.com/a/3420912
But i don't know if this is the best solution? Maybe a Set would be better for this kind of problem?