Andrew Gazelka
09/07/2020, 11:53 PMPriorityQueue
, where each value V
is sorted by according to a calculated priority: K = calc(V, otherStuff)
. I want to be able to remove and add V
to this priority queue based on equality. Should I
1. Have a Map<V,K>
that the priority queue references in the sorting function and store the raw V
in the priority queue
2. Use something like NodeEqValue<K,V>
that has overridden equality for V
3. Implemented some custom collection like TreeMap
but that allows multiple equivalent keys
4. Add custom remove (probably the best)Nir
09/08/2020, 2:11 AMNir
09/08/2020, 2:11 AMbezrukov
09/08/2020, 7:03 AMbezrukov
09/08/2020, 7:06 AMTreeMap<K, Queue<V>>
but it depends on your usecase