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

com.skillw.pouvoir.api.plugin.map.BaseMap.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 java.util.*
import java.util.concurrent.ConcurrentHashMap


/**
 * Base map
 *
 * @param K
 * @param V
 * @constructor Create empty Base map
 */
open class BaseMap : ConcurrentHashMap(), RegContainer {

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

    private val uuid = UUID.randomUUID()
    override fun register(key: K, value: V): V? {
        return put(key, value)
    }


    override fun remove(key: K, value: V): Boolean {
        return super.remove(key, value)
    }


    override fun equals(other: Any?): Boolean {
        if (this === other) return true
        if (other !is BaseMap<*, *>) return false
        return uuid == other.uuid
    }

    override fun hashCode(): Int {
        return uuid.hashCode()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy