aboutsummaryrefslogtreecommitdiff
path: root/core/src/main/kotlin/utilities/associateWithNotNull.kt
blob: ea2e8c3c0867928a809235c19f5dff726817d182 (plain)
1
2
3
4
5
6
package org.jetbrains.dokka.utilities

inline fun <K, V : Any> Iterable<K>.associateWithNotNull(valueSelector: (K) -> V?): Map<K, V> {
    @Suppress("UNCHECKED_CAST")
    return associateWith { valueSelector(it) }.filterValues { it != null } as Map<K, V>
}