I need to sort out based on frequency certain events that happen.
I use a map with the event name as the key(String) and the frequency(Integ er) as the value and every time an event happens.
I have no problems with the part of adding and updating but am abit stuck at the sorting part as I need to display the events sorted from higest frequency to lowest.
At first I was thinking of putting them into another hashmap with the frequency as the key as it auto sorts based on key but if I have 2 or more events with the same frequency, I might overwrite them.
TIA :)
I use a map with the event name as the key(String) and the frequency(Integ er) as the value and every time an event happens.
I have no problems with the part of adding and updating but am abit stuck at the sorting part as I need to display the events sorted from higest frequency to lowest.
At first I was thinking of putting them into another hashmap with the frequency as the key as it auto sorts based on key but if I have 2 or more events with the same frequency, I might overwrite them.
TIA :)
Comment