public static boolean containsOption ( final List < ? > options , final Object findOption ) { if ( options != null ) { for ( Object option : options ) { if ( option instanceof OptionGroup ) { List < ? > groupOptions = ( ( OptionGroup ) option ) . getOptions ( ) ; if ( groupOptions != null ) { for ( Object nestedOption : groupOptions ) { if ( Util . equals ( nestedOption , findOption ) ) { return true ; } } } } else if ( Util . equals ( option , findOption ) ) { return true ; } } } return false ; }
Iterate through the options to determine if an option exists .