Answers for "kotlin hashmap non nullable"

0

kotlin hashmap non nullable

class NonNullMap<K, V>(private val map: Map<K, V>) : Map<K, V> by map {
    override operator fun get(key: K): V {
        return map[key]!! // Force an NPE if the key doesn't exist
    }
}
Posted by: Guest on April-05-2022

Browse Popular Code Answers by Language