All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.com.seiko.imageloader.util.LruHashMap.jvm.kt Maven / Gradle / Ivy

There is a newer version: 1.8.3
Show newest version
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)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy