mirror of
https://github.com/GayPizzaSpecifications/foundation.git
synced 2025-08-30 17:51:31 +00:00
Gjallarhorn: Parallel Rendering and Quad Image Improvements
This commit is contained in:
@ -1,11 +1,12 @@
|
||||
package cloud.kubelet.foundation.gjallarhorn.util
|
||||
|
||||
import java.awt.Color
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
|
||||
class RandomColorKey {
|
||||
private val colors = mutableMapOf<String, Color>()
|
||||
private val colors = ConcurrentHashMap<String, Color>()
|
||||
|
||||
fun map(key: String) = colors.getOrPut(key) { findUniqueColor() }
|
||||
fun map(key: String) = colors.computeIfAbsent(key) { findUniqueColor() }
|
||||
|
||||
private fun findUniqueColor(): Color {
|
||||
var random = randomColor()
|
||||
|
Reference in New Issue
Block a user