code cleanup

master
Robinson 2023-08-02 22:24:47 -06:00
parent c12fc94835
commit 7f4e713e1c
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
1 changed files with 16 additions and 1 deletions

View File

@ -35,7 +35,6 @@ package dorkbox.collections
import dorkbox.collections.Collections.allocateIterators
import dorkbox.collections.Collections.random
import dorkbox.collections.ObjectMap.Companion.dummy
import dorkbox.collections.ObjectMap.Entry
import java.lang.IllegalStateException
import java.util.*
import kotlin.math.max
@ -884,6 +883,22 @@ class ArrayMap<K: Any, V> : MutableMap<K, V?>{
}
}
class Entry<K: Any, V>(val map: ArrayMap<K, V?>) : MutableMap.MutableEntry<K, V?> {
override lateinit var key: K
override var value: V? = null
override fun setValue(newValue: V?): V? {
val oldValue = value
map[key] = newValue
value = newValue
return oldValue
}
override fun toString(): String {
return "$key=$value"
}
}
class Values<V>(map: ArrayMap<Any, V?>) : MutableCollection<V>, Iterable<V>, MutableIterator<V> {
private val map: ArrayMap<Any, V?>
var index = 0