[Commonizer] Minor. Remove unused utility functions
This commit is contained in:
@@ -7,25 +7,12 @@ package org.jetbrains.kotlin.descriptors.commonizer.utils
|
|||||||
|
|
||||||
import com.intellij.util.SmartFMap
|
import com.intellij.util.SmartFMap
|
||||||
import gnu.trove.THashMap
|
import gnu.trove.THashMap
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor
|
|
||||||
import org.jetbrains.kotlin.descriptors.annotations.Annotations
|
|
||||||
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstance
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.Collections.singletonList
|
import java.util.Collections.singletonList
|
||||||
import java.util.Collections.singletonMap
|
import java.util.Collections.singletonMap
|
||||||
import kotlin.collections.ArrayList
|
import kotlin.collections.ArrayList
|
||||||
|
|
||||||
internal infix fun <K, V> Map<K, V>.compactConcat(other: Map<K, V>): Map<K, V> =
|
|
||||||
when {
|
|
||||||
isEmpty() -> other
|
|
||||||
other.isEmpty() -> this
|
|
||||||
else -> when (val capacity = size + other.size) {
|
|
||||||
0, 1 -> error("Unreachable code")
|
|
||||||
2, 3 -> SmartFMap.emptyMap<K, V>().plusAll(this).plusAll(other)
|
|
||||||
else -> THashMap<K, V>(capacity).also { it.putAll(this); it.putAll(other) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal inline fun <K : Any, V, R> Map<K, V>.compactMapValues(transform: (Map.Entry<K, V>) -> R): Map<K, R> =
|
internal inline fun <K : Any, V, R> Map<K, V>.compactMapValues(transform: (Map.Entry<K, V>) -> R): Map<K, R> =
|
||||||
when (size) {
|
when (size) {
|
||||||
0 -> emptyMap()
|
0 -> emptyMap()
|
||||||
@@ -74,9 +61,6 @@ internal inline fun <reified T> List<T>.compact(): List<T> =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inline fun <reified R> Annotations.compactMap(transform: (AnnotationDescriptor) -> R): List<R> =
|
|
||||||
if (isEmpty()) emptyList() else map(transform).compact()
|
|
||||||
|
|
||||||
internal fun <K, V> Map<K, V>.compact(): Map<K, V> =
|
internal fun <K, V> Map<K, V>.compact(): Map<K, V> =
|
||||||
when (size) {
|
when (size) {
|
||||||
0 -> emptyMap()
|
0 -> emptyMap()
|
||||||
|
|||||||
Reference in New Issue
Block a user