From b2a7464da2d32781a326e4cee9b60329837160ab Mon Sep 17 00:00:00 2001 From: Graham Date: Sun, 30 Aug 2020 09:03:43 +0100 Subject: [PATCH] Use Kotlin's new ArrayDeque class Signed-off-by: Graham --- .../main/java/dev/openrs2/util/collect/ForestDisjointSet.kt | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt b/util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt index 19eff687..aa9ecde1 100644 --- a/util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt +++ b/util/src/main/java/dev/openrs2/util/collect/ForestDisjointSet.kt @@ -1,7 +1,5 @@ package dev.openrs2.util.collect -import java.util.ArrayDeque - /** * A [DisjointSet] implementation backed by a disjoint-set forest, as described * in chapter 21.3 of the third edition of CLRS. It uses path compression and @@ -58,7 +56,7 @@ public class ForestDisjointSet : DisjointSet { } override fun next(): T { - val node = queue.poll() ?: throw NoSuchElementException() + val node = queue.removeFirstOrNull() ?: throw NoSuchElementException() queue.addAll(node.children) return node.value }