private synchronized void resetAnimations() { HashSet<GameObject> visited = new HashSet<>(); for (GameObject obj : this.currentLayout) { if (obj != null && !visited.contains(obj)) { obj.resetAnimation(); visited.add(obj); } } }