code cleanup

master
Robinson 2023-08-01 20:17:50 -06:00
parent a60dcdfbc5
commit da0601ad59
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
3 changed files with 7 additions and 7 deletions

View File

@ -527,12 +527,12 @@ class ArrayMap<K: Any, V> : MutableMap<K, V?>, MutableIterable<Entry<K, V?>> {
protected fun resize(newSize: Int) {
@Suppress("UNCHECKED_CAST")
val newKeys = java.lang.reflect.Array.newInstance(keyTable.javaClass.componentType, newSize) as kotlin.Array<K?>
val newKeys = java.lang.reflect.Array.newInstance(keyTable.javaClass.componentType, newSize) as Array<K?>
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<V?>
val newValues = java.lang.reflect.Array.newInstance(valueTable.javaClass.componentType, newSize) as Array<V?>
System.arraycopy(valueTable, 0, newValues, 0, min(size_.toDouble(), newValues.size.toDouble()).toInt())
valueTable = newValues
}

View File

@ -111,7 +111,7 @@ class ExpandingArray<T> : Iterable<T> {
* 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<T>) : this(true, array, 0, array.size)
constructor(array: Array<T>) : 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<T> : Iterable<T> {
*
* @return [.items]
*/
fun shrink(): kotlin.Array<T?> {
fun shrink(): Array<T?> {
if (items.size != size) resize(size)
return items
}
@ -499,7 +499,7 @@ class ExpandingArray<T> : Iterable<T> {
*
* @return [.items]
*/
fun ensureCapacity(additionalCapacity: Int): kotlin.Array<T?> {
fun ensureCapacity(additionalCapacity: Int): Array<T?> {
require(additionalCapacity >= 0) { "additionalCapacity must be >= 0: $additionalCapacity" }
val sizeNeeded = size + additionalCapacity
if (sizeNeeded > items.size) resize(
@ -513,7 +513,7 @@ class ExpandingArray<T> : Iterable<T> {
*
* @return [.items]
*/
fun setSize(newSize: Int): kotlin.Array<T?> {
fun setSize(newSize: Int): Array<T?> {
truncate(newSize)
if (newSize > items.size) resize(max(8.0, newSize.toDouble()).toInt())
size = newSize

View File

@ -364,7 +364,7 @@ class IntSet: MutableSet<Int> {
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]