public static <G extends GroupedOptions> G select(String[] params, G... groupings)
    {
        for (String param : params)
        {
            boolean accepted = false;
            for (GroupedOptions grouping : groupings)
                accepted |= grouping.accept(param);
            if (!accepted)
                throw new IllegalArgumentException("Invalid parameter " + param);
        }
        for (G grouping : groupings)
            if (grouping.happy() && grouping.accepted == params.length)
                return grouping;
        return null;
    }
public static < G extends GroupedOptions > G select ( String [ ] params , G ... groupings ) { for ( String param : params ) { boolean accepted = false ; for ( GroupedOptions grouping : groupings ) accepted |= grouping . accept ( param ) ; if ( ! accepted ) throw new IllegalArgumentException ( "Invalid parameter " + param ) ; } for ( G grouping : groupings ) if ( grouping . happy ( ) && grouping . accepted == params . length ) return grouping ; return null ; }
option group that is happy() after this is done, that also accepted all the parameters