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

import org.jetbrains.dokka.InternalDokkaApi

@InternalDokkaApi
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>
}