private static Option findTemplate(String name, Option[] templates) {
        boolean listAllowed = false;
        Option listOption = null;

        for (int i = 0; i < templates.length; i++) {
            if (templates[i].getName().equals(name)) {
                return templates[i];
            }
            if (Type.LIST.equals(templates[i].getType())) {
                listAllowed = true;
                listOption = templates[i];
            }
        }
        if (listAllowed) {
            return listOption;
        }
        return null;
    }
private static Option findTemplate ( String name , Option [ ] templates ) { boolean listAllowed = false ; Option listOption = null ; for ( int i = 0 ; i < templates . length ; i ++ ) { if ( templates [ i ] . getName ( ) . equals ( name ) ) { return templates [ i ] ; } if ( Type . LIST . equals ( templates [ i ] . getType ( ) ) ) { listAllowed = true ; listOption = templates [ i ] ; } } if ( listAllowed ) { return listOption ; } return null ; }
Searches an array of option templates and returns an option matching the supplied name or null if no match is found.

@param   name       The name of the option to search for
@param   templates  An array of option templates in which to search

@return  An Option object matching the supplied option name or null if no match is found