elect
04/26/2019, 7:46 PMMutableMap
till now, but it's quite ugly to extract the K given the V (I can loop on the whole entries
and get the first match).
Is there anything better for my case?serebit
04/26/2019, 7:49 PMO(1)
, retrieving keys by value is slower as it needs to search through all keys to get one with a matching value. A list of pairs could do the job, but that would be O(n) both waysDominaezzz
04/26/2019, 7:50 PMclass BiMap<K, V> {
val map1: Map<K, V>
val map2: Map<V, K>
}
ghedeon
04/26/2019, 7:51 PMelect
04/26/2019, 7:52 PM