private static void optionListGroups(List<ArgGroupSpec> groups, List<ArgGroupSpec> result) {
        for (ArgGroupSpec group : groups) {
            optionListGroups(group.subgroups(), result);
            if (group.heading() != null) {
                result.add(group);
            }
        }
    }
Returns the list of {@code ArgGroupSpec}s with a non-{@code null} heading.
docs/genadoc.java