diff --git a/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/DataFlowAnalyzer.kt b/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/DataFlowAnalyzer.kt index 87b5b480..e9c564c7 100644 --- a/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/DataFlowAnalyzer.kt +++ b/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/analysis/DataFlowAnalyzer.kt @@ -50,7 +50,7 @@ public abstract class DataFlowAnalyzer(owner: String, private val method: Met workList += graph.vertexSet().filter { vertex -> graph.inDegreeOf(vertex) == 0 } while (true) { - val node = workList.poll() ?: break + val node = workList.removeFirstOrNull() ?: break val predecessors = graph.incomingEdgesOf(node).map { edge -> outSets[graph.getEdgeSource(edge)] ?: initialSet diff --git a/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/ConstantArgTransformer.kt b/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/ConstantArgTransformer.kt index 70e6ea4b..65303421 100644 --- a/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/ConstantArgTransformer.kt +++ b/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/ConstantArgTransformer.kt @@ -72,7 +72,7 @@ public class ConstantArgTransformer @Inject constructor(private val profile: Pro queueEntryPoints(classPath) while (true) { - val method = pendingMethods.poll() ?: break + val method = pendingMethods.removeFirstOrNull() ?: break analyzeMethod(classPath, method) } } diff --git a/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/UnusedMethodTransformer.kt b/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/UnusedMethodTransformer.kt index 1f4e656c..ef4c4de8 100644 --- a/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/UnusedMethodTransformer.kt +++ b/deob-bytecode/src/main/kotlin/org/openrs2/deob/bytecode/transform/UnusedMethodTransformer.kt @@ -31,7 +31,7 @@ public class UnusedMethodTransformer @Inject constructor(private val profile: Pr queueEntryPoints(classPath) while (true) { - val method = pendingMethods.poll() ?: break + val method = pendingMethods.removeFirstOrNull() ?: break analyzeMethod(classPath, method) } } diff --git a/game/src/main/kotlin/org/openrs2/game/net/js5/Js5Service.kt b/game/src/main/kotlin/org/openrs2/game/net/js5/Js5Service.kt index 9865670b..c44e442b 100644 --- a/game/src/main/kotlin/org/openrs2/game/net/js5/Js5Service.kt +++ b/game/src/main/kotlin/org/openrs2/game/net/js5/Js5Service.kt @@ -36,7 +36,7 @@ public class Js5Service @Inject constructor( return } - val next = clients.poll() + val next = clients.removeFirstOrNull() if (next == null) { lock.wait() continue diff --git a/util/src/main/kotlin/org/openrs2/util/collect/UniqueQueue.kt b/util/src/main/kotlin/org/openrs2/util/collect/UniqueQueue.kt index d6f4e87f..e0c82465 100644 --- a/util/src/main/kotlin/org/openrs2/util/collect/UniqueQueue.kt +++ b/util/src/main/kotlin/org/openrs2/util/collect/UniqueQueue.kt @@ -27,7 +27,7 @@ public class UniqueQueue { addAll(vs) } - public fun poll(): T? { + public fun removeFirstOrNull(): T? { val v = queue.removeFirstOrNull() if (v != null) { set.remove(v) diff --git a/util/src/test/kotlin/org/openrs2/util/collect/UniqueQueueTest.kt b/util/src/test/kotlin/org/openrs2/util/collect/UniqueQueueTest.kt index 535699c3..14516424 100644 --- a/util/src/test/kotlin/org/openrs2/util/collect/UniqueQueueTest.kt +++ b/util/src/test/kotlin/org/openrs2/util/collect/UniqueQueueTest.kt @@ -8,15 +8,15 @@ import kotlin.test.assertTrue class UniqueQueueTest { @Test - fun testAddPoll() { + fun testAddRemove() { val queue = UniqueQueue() assertTrue(queue.add("a")) assertTrue(queue.add("b")) assertFalse(queue.add("a")) - assertEquals("a", queue.poll()) - assertEquals("b", queue.poll()) - assertNull(queue.poll()) + assertEquals("a", queue.removeFirstOrNull()) + assertEquals("b", queue.removeFirstOrNull()) + assertNull(queue.removeFirstOrNull()) } @Test @@ -24,9 +24,9 @@ class UniqueQueueTest { val queue = UniqueQueue() queue.addAll(listOf("a", "b", "a")) - assertEquals("a", queue.poll()) - assertEquals("b", queue.poll()) - assertNull(queue.poll()) + assertEquals("a", queue.removeFirstOrNull()) + assertEquals("b", queue.removeFirstOrNull()) + assertNull(queue.removeFirstOrNull()) } @Test @@ -36,6 +36,6 @@ class UniqueQueueTest { queue.clear() - assertNull(queue.poll()) + assertNull(queue.removeFirstOrNull()) } }