Posted By:
Christopher_Schultz
Posted On:
Friday, February 8, 2002 05:26 AM
I don't think you can do this, especially using a
Comparator. If you provide a custom
Comparator, you'll end up only being able to compare different
String objects (the keys).
Why do you want to sort the structure by the floating point values? In this scenario, the TreeMap doesn't make any sense; the keys are sorted (by definition) to allow fast lookups of data.
Consider using a separate structure to store your values, or have a parallel structure (perhaps a TreeMap) which has your keys and values in reversed roles (key=Float, value=String).
-chris