diff --git a/platform/util-ex/src/com/intellij/util/containers/LookbackSequence.kt b/platform/util-ex/src/com/intellij/util/containers/LookbackSequence.kt index c0353811f3a1..972c2dc4420f 100644 --- a/platform/util-ex/src/com/intellij/util/containers/LookbackSequence.kt +++ b/platform/util-ex/src/com/intellij/util/containers/LookbackSequence.kt @@ -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 = Pair @@ -28,4 +28,8 @@ private class LookbackIterator(private val iterator: Iterator) : Iterator< } } -fun Map.reverse(): Map = map { (k, v) -> v to k }.toMap() +@Deprecated( + message = "Moved to another file", + level = DeprecationLevel.HIDDEN, +) +fun Map.reverse(): Map = reverse() diff --git a/platform/util/src/com/intellij/util/containers/util.kt b/platform/util/src/com/intellij/util/containers/util.kt index d02f4904467f..1377038d0889 100644 --- a/platform/util/src/com/intellij/util/containers/util.kt +++ b/platform/util/src/com/intellij/util/containers/util.kt @@ -320,3 +320,5 @@ fun generateRecursiveSequence(initialSequence: Sequence, children: * Returns a new sequence either of single given element, if it is not null, or empty sequence if the element is null. */ fun sequenceOfNotNull(element: T?): Sequence = if (element == null) emptySequence() else sequenceOf(element) + +fun Map.reverse(): Map = map { (k, v) -> v to k }.toMap()