io.github.tt432.eyelib.util.data.Blackboard Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of eyelib Show documentation
Show all versions of eyelib Show documentation
A render lib for Minecraft
package io.github.tt432.eyelib.util.data;
import java.util.HashMap;
import java.util.Map;
/**
* @author TT432
*/
public final class Blackboard {
private final Map data = new HashMap<>();
public void put(String key, Object value) {
data.put(key, value);
}
@SuppressWarnings("unchecked")
public T getOrDefault(String key, T defaultValue) {
return (T) data.getOrDefault(key, defaultValue);
}
@SuppressWarnings("unchecked")
public T get(String key) {
return (T) data.get(key);
}
@SuppressWarnings("unchecked")
public T getOrCreate(String key, T defaultValue) {
return (T) data.computeIfAbsent(key, k -> defaultValue);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy