From da0601ad59d9b206e641e322f0c0e97fc715967f Mon Sep 17 00:00:00 2001 From: Robinson Date: Tue, 1 Aug 2023 20:17:50 -0600 Subject: [PATCH] code cleanup --- src/dorkbox/collections/ArrayMap.kt | 4 ++-- src/dorkbox/collections/ExpandingArray.kt | 8 ++++---- src/dorkbox/collections/IntSet.kt | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/dorkbox/collections/ArrayMap.kt b/src/dorkbox/collections/ArrayMap.kt index ef2c9c7..42f741c 100644 --- a/src/dorkbox/collections/ArrayMap.kt +++ b/src/dorkbox/collections/ArrayMap.kt @@ -527,12 +527,12 @@ class ArrayMap : MutableMap, MutableIterable> { protected fun resize(newSize: Int) { @Suppress("UNCHECKED_CAST") - val newKeys = java.lang.reflect.Array.newInstance(keyTable.javaClass.componentType, newSize) as kotlin.Array + val newKeys = java.lang.reflect.Array.newInstance(keyTable.javaClass.componentType, newSize) as Array System.arraycopy(keyTable, 0, newKeys, 0, min(size_.toDouble(), newKeys.size.toDouble()).toInt()) keyTable = newKeys @Suppress("UNCHECKED_CAST") - val newValues = java.lang.reflect.Array.newInstance(valueTable.javaClass.componentType, newSize) as kotlin.Array + val newValues = java.lang.reflect.Array.newInstance(valueTable.javaClass.componentType, newSize) as Array System.arraycopy(valueTable, 0, newValues, 0, min(size_.toDouble(), newValues.size.toDouble()).toInt()) valueTable = newValues } diff --git a/src/dorkbox/collections/ExpandingArray.kt b/src/dorkbox/collections/ExpandingArray.kt index 8a2ed77..7433358 100644 --- a/src/dorkbox/collections/ExpandingArray.kt +++ b/src/dorkbox/collections/ExpandingArray.kt @@ -111,7 +111,7 @@ class ExpandingArray : Iterable { * backing array. The capacity is set to the number of elements, so any subsequent elements added will cause the backing array * to be grown. */ - constructor(array: kotlin.Array) : this(true, array, 0, array.size) + constructor(array: Array) : this(true, array, 0, array.size) /** * Creates a new array containing the elements in the specified array. The new array will have the same type of backing array. @@ -488,7 +488,7 @@ class ExpandingArray : Iterable { * * @return [.items] */ - fun shrink(): kotlin.Array { + fun shrink(): Array { if (items.size != size) resize(size) return items } @@ -499,7 +499,7 @@ class ExpandingArray : Iterable { * * @return [.items] */ - fun ensureCapacity(additionalCapacity: Int): kotlin.Array { + fun ensureCapacity(additionalCapacity: Int): Array { require(additionalCapacity >= 0) { "additionalCapacity must be >= 0: $additionalCapacity" } val sizeNeeded = size + additionalCapacity if (sizeNeeded > items.size) resize( @@ -513,7 +513,7 @@ class ExpandingArray : Iterable { * * @return [.items] */ - fun setSize(newSize: Int): kotlin.Array { + fun setSize(newSize: Int): Array { truncate(newSize) if (newSize > items.size) resize(max(8.0, newSize.toDouble()).toInt()) size = newSize diff --git a/src/dorkbox/collections/IntSet.kt b/src/dorkbox/collections/IntSet.kt index b462465..921a68d 100644 --- a/src/dorkbox/collections/IntSet.kt +++ b/src/dorkbox/collections/IntSet.kt @@ -364,7 +364,7 @@ class IntSet: MutableSet { mask = newSize - 1 shift = java.lang.Long.numberOfLeadingZeros(mask.toLong()) val oldKeyTable = keyTable - keyTable = kotlin.IntArray(newSize) + keyTable = IntArray(newSize) if (size_ > 0) { for (i in 0 until oldCapacity) { val key = oldKeyTable[i]