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

com.skillw.pouvoir.api.plugin.map.LowerKeyMap.kt Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
package com.skillw.pouvoir.api.plugin.map

import com.skillw.pouvoir.api.plugin.map.component.Keyable
import java.util.function.BiFunction
import java.util.function.Function


/**
 * Lower key map
 *
 * @param V
 * @constructor Create empty Lower key map
 */
open class LowerKeyMap> : KeyMap() {


    override operator fun get(key: String): V? {
        return super.get(key.lowercase())
    }

    override fun remove(key: String): V? {
        return super.remove(key.lowercase())
    }

    override fun containsKey(key: String): Boolean {
        return super.containsKey(key.lowercase())
    }

    override operator fun set(key: String, value: V): V? {
        return super.put(key.lowercase(), value)
    }

    override fun put(key: String, value: V): V? {
        return super.put(key.lowercase(), value)
    }

    override fun putAll(from: Map) {
        super.putAll(from.mapKeys { it.key.lowercase() })
    }

    override fun computeIfAbsent(key: String, mappingFunction: Function): V {
        return super.computeIfAbsent(key.lowercase(), mappingFunction)
    }

    override fun compute(key: String, remappingFunction: BiFunction): V? {
        return super.compute(key.lowercase(), remappingFunction)
    }

    override fun merge(key: String, value: V, remappingFunction: BiFunction): V? {
        return super.merge(key.lowercase(), value, remappingFunction)
    }

    override fun putIfAbsent(key: String, value: V): V? {
        return super.putIfAbsent(key.lowercase(), value)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy