boolean (Object object) { if (!(object instanceof Group group)) return false; if (group.getName() != null && getName() != null) { return group.getName().equals(getName()); } if (getChildren() != null && group.getChildren() != null) { if (getChildren().size() != group.getChildren().size()) { return false; } for (int i = 0; i < getChildren().size(); i++) { if (!getChildren().get(i).equals(group.getChildren().get(i))) { return false; } } return true; } return false; }