com.skillw.pouvoir.api.plugin.map.LowerKeyMap.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Pouvoir Show documentation
Show all versions of Pouvoir Show documentation
Bukkit Script Engine Plugin.
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