diff options
author | Linnea Gräf <nea@nea.moe> | 2024-01-18 20:00:47 +0100 |
---|---|---|
committer | Linnea Gräf <nea@nea.moe> | 2024-01-18 20:00:47 +0100 |
commit | 608fec9cd0bbe3cf389faaeb7e258b592e3adf14 (patch) | |
tree | ef7996342498f64529ac6eb5851b2a61a1973d1c /src/main/kotlin/moe/nea/firmament/util | |
parent | d7902e06cd7285c72cd4ea2be6f18ead56a8775e (diff) | |
download | Firmament-608fec9cd0bbe3cf389faaeb7e258b592e3adf14.tar.gz Firmament-608fec9cd0bbe3cf389faaeb7e258b592e3adf14.tar.bz2 Firmament-608fec9cd0bbe3cf389faaeb7e258b592e3adf14.zip |
Add Nearby Burrow Highlighter
Diffstat (limited to 'src/main/kotlin/moe/nea/firmament/util')
-rw-r--r-- | src/main/kotlin/moe/nea/firmament/util/MutableMapWithMaxSize.kt | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/kotlin/moe/nea/firmament/util/MutableMapWithMaxSize.kt b/src/main/kotlin/moe/nea/firmament/util/MutableMapWithMaxSize.kt new file mode 100644 index 0000000..8032053 --- /dev/null +++ b/src/main/kotlin/moe/nea/firmament/util/MutableMapWithMaxSize.kt @@ -0,0 +1,13 @@ +/* + * SPDX-FileCopyrightText: 2024 Linnea Gräf <nea@nea.moe> + * + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +package moe.nea.firmament.util + +fun <K, V> mutableMapWithMaxSize(maxSize: Int): MutableMap<K, V> = object : LinkedHashMap<K, V>() { + override fun removeEldestEntry(eldest: MutableMap.MutableEntry<K, V>): Boolean { + return size > maxSize + } +} |