HashMap
SC-W1019A duplicate key exists in the HashMap
. This may lead to an unintentional behaviour as the key will always map to the last value provided to it and hence is always recommended that these keys be unique.
val freq = immutable.HashMap[Char, Int](('a', 1), ('b', 3), ('c', 4), ('a', 2)) // duplicate key 'a'
All keys should be unique
val freq = immutable.HashMap[Char, Int](('a', 1), ('b', 3), ('c', 4)) // duplicate key 'a' removed