private Group findGroupNested ( Group parent , String name ) { for ( Group g : parent . getGroups ( ) ) { if ( g . getShortName ( ) . equals ( name ) ) { return g ; } } for ( Group g : parent . getGroups ( ) ) { Group result = findGroupNested ( g , name ) ; if ( result != null ) { return result ; } } return null ; }
look for a group with the given name . recurse into subgroups if needed . breadth first