aaverin
02/28/2017, 3:48 PMclass MultiMap<K, V> : HashMap<K, MutableList<V>>() {
fun put(key: K, value: V) {
var entries = get(key)
if (entries == null) {
entries = mutableListOf<V>()
put(key, entries)
}
entries.add(value)
}
}
That in Java Spring project fails to compile with:
MultiMap.kt: (5, 7): Inherited platform declarations clash: The following declarations have the same JVM signature (getOrDefault(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;):
fun getOrDefault(key: K, defaultValue: MutableList<V>): MutableList<V>
fun getOrDefault(key: Any!, defaultValue: MutableList<V>!): MutableList<V>!
What would a proper fix?