[FIR] Use optimized stdlib version of reversed list

This commit is contained in:
Kirill Rakhman
2023-05-26 16:26:50 +02:00
committed by Space Team
parent 8066f1b7d2
commit a4c9a4f150
4 changed files with 3 additions and 30 deletions
@@ -1,15 +0,0 @@
/*
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package org.jetbrains.kotlin.fir.util
private open class FrozenReversedListReadOnly<out T>(
private val delegate: List<T>
) : AbstractList<T>() {
override val size: Int = delegate.size
override fun get(index: Int): T = delegate[size - 1 - index]
}
fun <T> List<T>.asReversedFrozen(): List<T> = FrozenReversedListReadOnly(this)