Kotlin HashMap mapNotNullTo()
Syntax & Examples


Syntax of HashMap.mapNotNullTo()

The syntax of HashMap.mapNotNullTo() extension function is:

fun <K, V, R : Any, C : MutableCollection<in R>> Map<out K, V>.mapNotNullTo( destination: C, transform: (Entry<K, V>) -> R? ): C

This mapNotNullTo() extension function of HashMap applies the given transform function to each entry in the original map and appends only the non-null results to the given destination.