From 4fc031a3fe019e0e68ada2464c7406648b775fdc Mon Sep 17 00:00:00 2001 From: lisonge Date: Fri, 11 Oct 2024 16:02:59 +0800 Subject: [PATCH] perf: removeLast --- app/src/main/kotlin/li/songe/gkd/data/NodeInfo.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/li/songe/gkd/data/NodeInfo.kt b/app/src/main/kotlin/li/songe/gkd/data/NodeInfo.kt index 5aeb8d6..fe2397b 100644 --- a/app/src/main/kotlin/li/songe/gkd/data/NodeInfo.kt +++ b/app/src/main/kotlin/li/songe/gkd/data/NodeInfo.kt @@ -58,7 +58,7 @@ data class NodeInfo( stack.add(TempNodeData(root, null, 0, 0)) while (stack.isNotEmpty()) { times++ - val node = stack.removeLast() + val node = stack.removeAt(stack.lastIndex) node.id = times - 1 val children = getChildren(node.node).mapIndexed { i, child -> TempNodeData( @@ -131,7 +131,7 @@ data class NodeInfo( } else { val tempStack = mutableListOf(n) while (tempStack.isNotEmpty()) { - val top = tempStack.removeLast() + val top = tempStack.removeAt(tempStack.lastIndex) top.idQf = n.idQf if (idTextQf) { top.textQf = n.textQf @@ -168,7 +168,7 @@ data class NodeInfo( } else { val tempStack = mutableListOf(n) while (tempStack.isNotEmpty()) { - val top = tempStack.removeLast() + val top = tempStack.removeAt(tempStack.lastIndex) top.textQf = n.textQf if (idTextQf) { top.idQf = n.idQf