public String nextCommand() { String nextCommand = "WAIT"; if (!rotationMap.isEmpty()) { Room rotatedRoom = rotationMap.remove(rotationMap.firstKey()); if (rotatedRoom.getRotation() > 0) { rotatedRoom.rotateRightActType(); nextCommand = rotatedRoom.getPosition() + " RIGHT"; } else if (rotatedRoom.getRotation() < 0) { rotatedRoom.rotateLeftActType(); nextCommand = rotatedRoom.getPosition() + " LEFT"; } } return nextCommand; }