Skip to content

Commit

Permalink
perf: removeLast
Browse files Browse the repository at this point in the history
  • Loading branch information
lisonge committed Oct 11, 2024
1 parent 2ae5698 commit 4fc031a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/kotlin/li/songe/gkd/data/NodeInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 4fc031a

Please sign in to comment.