From 2f1616d2ac41f64df091fea92e042d51485f4cd5 Mon Sep 17 00:00:00 2001 From: ImplementsLegend Date: Mon, 8 Apr 2024 11:56:35 +0200 Subject: [PATCH] Revert "Class for collecting stuff" This reverts commit 931f2ba002a724c6b79e791f782dcfcb6ddc3c47. --- ...micallyIndexedConcurrentArrayCollection.kt | 39 ------------------- 1 file changed, 39 deletions(-) delete mode 100644 src/main/java/implementslegend/mod/vaultfaster/AtomicallyIndexedConcurrentArrayCollection.kt diff --git a/src/main/java/implementslegend/mod/vaultfaster/AtomicallyIndexedConcurrentArrayCollection.kt b/src/main/java/implementslegend/mod/vaultfaster/AtomicallyIndexedConcurrentArrayCollection.kt deleted file mode 100644 index bec7ee1..0000000 --- a/src/main/java/implementslegend/mod/vaultfaster/AtomicallyIndexedConcurrentArrayCollection.kt +++ /dev/null @@ -1,39 +0,0 @@ -package implementslegend.mod.vaultfaster - -import java.util.concurrent.atomic.AtomicInteger - - -inline fun concurrentArrayCollection(capacity:Int) = AtomicallyIndexedConcurrentArrayCollection(arrayOfNulls(capacity)) -class AtomicallyIndexedConcurrentArrayCollection(val initialArray: Array):Collection { - - - val index = AtomicInteger(0) - fun add(element:T){ - val position = index.incrementAndGet() - initialArray[position]=element - } - - override val size: Int - get() = index.get() - - @Suppress("ReplaceSizeCheckWithIsNotEmpty") - override fun isEmpty(): Boolean = size!=0 - - override fun iterator(): Iterator { - var position = 0 - return object :Iterator{ - override fun hasNext(): Boolean = position): Boolean = elements.all(::contains) - - override fun contains(element: T): Boolean = this.any { element == it } - - -} \ No newline at end of file