public final class Switch<T> {private final HashMap<T, Runnable> cases = new HashMap<T, Runnable>(0);
public void addCase(T object, Runnable action) {this.cases.put(object, action);}
public void SWITCH(T object) {for (T t : this.cases.keySet()) {if (object.equals(t)) { // This means that the class works with any object!this.cases.get(t).run();break;}}}}
final String LEFT = "left";final String RIGHT = "right";final String UP = "up";final String DOWN = "down";
String var = ...;
switch (var) {case LEFT:case RIGHT:case DOWN:default:return 0;}
String translation(String cat_language) {return switch (cat_language) {case "miau miau" -> "I am to run";case "miauuuh" -> "I am to sleep";case "mi...au?" -> "leave me alone";default -> "eat";};}