code: protected void collectGroups(Group group, Set<String> groupSet) {
  
      Enumeration<? extends Principal> members = group.members();
      while (members.hasMoreElements()) {
        Principal member = members.nextElement();
        String name = member.getName();
        boolean added = groupSet.add(name);
        if (added && (member instanceof Group)) {
          collectGroups((Group) member, groupSet);
        }
      }
    }
docs: Called from {@link #getAccessControlIds(Group)} to recursively collect the groups.
  
  @param group is the {@link Group} to traverse.
  @param groupSet is the {@link Set} where to add the principal names.