code: private List<?> findValidOptions(final List<?> options, final List<?> selected,
  			final boolean handleInvalid) {
  		// No selection made
  		if (selected == null || selected.isEmpty()) {
  			// No Selection required, or no options to select
  			if (isAllowNoSelection() || options == null || options.isEmpty()) {
  				return null;
  			} else { // Selection is required
  				// Check if NULL is an option
  				if (selected == null && SelectListUtil.containsOption(options, null)) {
  					return null;
  				}
  
  				// Must have a selected option
  				throw new IllegalStateException(
  						"A valid option must be selected for lists that require a selected option.");
  			}
  		}
  
  		// Check we have valid options (If options are matched via Option/Code or Legacy Matching, then return a list of
  		// the actual options)
  		List<Object> validSelections = new ArrayList<>();
  
  		for (Object selectedOption : selected) {
  			boolean found = false;
  
  			if (options != null) {
  				if (selectedOption == null) {
  					found = SelectListUtil.containsOption(options, null);
  					if (found) {
  						validSelections.add(null);
  					}
  				} else {
  					Object option = SelectListUtil.getOptionWithMatching(options, selectedOption);
  					if (option != null) {
  						found = true;
  						validSelections.add(option);
  					}
  				}
  			}
  
  			if (!found) {
  				if (isEditable() && selectedOption instanceof String) {
  					validSelections.add(selectedOption);
  				} else if (handleInvalid) { // Handle invalid option
  					List<?> valid = doHandleInvalidOption(selectedOption);
  					setSelected(valid);
  					return valid;
  				} else {
  					throw new IllegalStateException("The selection \"" + selectedOption
  							+ "\" is not an available option.");
  				}
  			}
  		}
  
  		return validSelections;
  
  	}
docs: Find the valid options for the selected data, allowing for option/code and legacy matching.
  
  @param options the list of options
  @param selected the options to search for
  @param handleInvalid true if allow handle invalid options
  @return the valid option