public static OptionElement findByName ( List < OptionElement > options , String name ) { checkNotNull ( options , "options" ) ; checkNotNull ( name , "name" ) ; OptionElement found = null ; for ( OptionElement option : options ) { if ( option . name ( ) . equals ( name ) ) { if ( found != null ) { throw new IllegalStateException ( "Multiple options match name: " + name ) ; } found = option ; } } return found ; }
Return the option with the specified name from the supplied list or null .