code cleanup
parent
c12fc94835
commit
7f4e713e1c
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue