Here's my problem i have two data structure one : countMark = new HashMap<Pair<String, String>, Integer>();
and the other which is the inverse orderMark = new TreeMap<Integer, List<Pair<String, String>>>();
. I use the second one the quickly find the maximum value and the select a pair according to some rules.
But in my code i need to use orderMark.containsKey(counter)
and that's not very efficient. As i increment the counter i also need to delete the specific pair. In consequence i have to do this orderMark.get(count - 1).remove(key);
.
My question is i find that i could use MultiSet and MultiMap from Guava library but i didn't find the complexity about this data structure for add, contains, remove and get. And i would need a sorted map in order to select the pair which has the maximum value.
I hope that was sufficiently clear and thank you in advance for your answers.