

While I might personally prefer sticking with null-safe calls and elvis operators, it sounds like you'd prefer cleaner code at the call site (especially considering you know these keys exist and have associated non-null values).

MapOf() is providing a Map with no guarantees for the presence of a key- something which is kind of expected especially considering the Java implementation of Map. Perhaps some others from Dan Lew here would be useful for you? For creating the latentit variable, we need to add the keyword name as lateinit as an access modifier for that variable. You can try map.getValue(key) instead of map.get(key) but I personally think that's unclean and confusing. The library of kotlin provides two different types of access modifiers for the declaration of property. TypeAliases.kt public actual typealias LinkedHashMap = If (pairs.size > 0) pairs.toMap(LinkedHashMap(mapCapacity(pairs.size))) else emptyMap() Maps.kt public fun mapOf(vararg pairs: Pair): Map = More specifically, behind the scene, mapOf gives us a Kotlin's LinkedHashMap which is not a different class but a just a typealias of Java's LinkedHashMap If you still want to achieve non-null-value only map, you'll need to implement your own e.g. At the moment, Kotlin's *Map classes has the exact implementation as Java's *Map classes. As others have pointed out, this doesn't have to do with mutability but the fact that Java's Maps accept null as valid values.

The short answer is you can't achieve that until Kotlin changes.
