Updated on 2026-08-14
This commit is contained in:
parent
90fea21f17
commit
1841d77c4c
13 changed files with 57 additions and 347 deletions
11
core/utils/src/main/java/com/tangem/utils/extensions/Map.kt
Normal file
11
core/utils/src/main/java/com/tangem/utils/extensions/Map.kt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
package com.tangem.utils.extensions
|
||||
|
||||
fun <K, V, R> Map<K, V>.mapNotNullValues(transform: (Map.Entry<K, V>) -> R?): Map<K, R> {
|
||||
return this
|
||||
.mapNotNull { entry ->
|
||||
val newValue = transform(entry) ?: return@mapNotNull null
|
||||
|
||||
entry.key to newValue
|
||||
}
|
||||
.toMap()
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue