doc / ch.tutteli.atrium.domain.builders.utils / nullableValueMap

nullableValueMap

inline fun <K : Any, V> nullableValueMap(map: Map<K, V>): Map<K, V?>

Turns a Map into a map with 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 nullableValueMap(getPersons())