jvmMain.com.seiko.imageloader.util.LruHashMap.jvm.kt Maven / Gradle / Ivy
package com.seiko.imageloader.util
internal actual class LruHashMap actual constructor(
initialCapacity: Int,
loadFactor: Float,
) {
actual constructor(original: LruHashMap) : this() {
for ((key, value) in original.entries) {
put(key, value)
}
}
private val map = LinkedHashMap(initialCapacity, loadFactor, true)
actual val isEmpty: Boolean get() = map.isEmpty()
actual val entries: Set> get() = map.entries
actual operator fun get(key: K): V? = map[key]
actual fun put(key: K, value: V): V? = map.put(key, value)
actual fun remove(key: K): V? = map.remove(key)
}