static B getAndRemove(Map map, A a) { if (!containsKey(map, a)) null; B b = map.get(a); map.remove(a); ret b; }