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

import org.jetbrains.dokka.*

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