public Map<String, Boolean> zoom = new HashMap<String, Boolean>();
public void Toggle() {
if(zoom.containsKey("test")){
// Turning off
zoom.remove("test");
} else {
// Turning on.
zoom.put("test", false);
}
}
I use a HashMap to accomplish it, but i never use the Boolean.
So how can i get rid of the hashmap, without having too much problems?
Just change:
to
Then replace all calls to
put(String, Boolean)withadd(String), calls toremovewon’t change, and calls tocontainsKey(String)are replaced withcontains(String).