doc / ch.tutteli.atrium.logic.utils / nullableKeyValueMap

nullableKeyValueMap

inline fun <K, V> nullableKeyValueMap(map: Map<out K, V>): Map<out K?, V?> (source)

Turns a Map into a map with a nullable key and a nullable value type.

Intended to be used in conjunction with platform types such as Map<Int!, String!`>! or in other words, when you deal with Java and you want to turn a platform type into a nullable type.

Basically it is a replacement for cast but without introducing one explicitly (we only give an additional hint to the compiler that we expect a nullable type and not a non-nullable one). For instance, instead of writing getPersons() as Map<String?, Person?> you can write nullableKeyValueMap(getPersons())