mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
move Map.reverse extension function to intellij.platform.util
GitOrigin-RevId: 33aa23554a13b6aaa33249d2c57d69746b75d606
This commit is contained in:
committed by
intellij-monorepo-bot
parent
8ad7ba225c
commit
7f3964f4c7
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.util.containers
|
||||
|
||||
typealias LookbackValue<T> = Pair<T, T?>
|
||||
@@ -28,4 +28,8 @@ private class LookbackIterator<T>(private val iterator: Iterator<T>) : Iterator<
|
||||
}
|
||||
}
|
||||
|
||||
fun <K, V : Any> Map<K, V>.reverse(): Map<V, K> = map { (k, v) -> v to k }.toMap()
|
||||
@Deprecated(
|
||||
message = "Moved to another file",
|
||||
level = DeprecationLevel.HIDDEN,
|
||||
)
|
||||
fun <K, V : Any> Map<K, V>.reverse(): Map<V, K> = reverse()
|
||||
|
||||
@@ -320,3 +320,5 @@ fun <Node> generateRecursiveSequence(initialSequence: Sequence<Node>, children:
|
||||
* Returns a new sequence either of single given element, if it is not null, or empty sequence if the element is null.
|
||||
*/
|
||||
fun <T : Any> sequenceOfNotNull(element: T?): Sequence<T> = if (element == null) emptySequence() else sequenceOf(element)
|
||||
|
||||
fun <K, V : Any> Map<K, V>.reverse(): Map<V, K> = map { (k, v) -> v to k }.toMap()
|
||||
|
||||
Reference in New Issue
Block a user