private SelectItem findSelectItem(FacesContext fc, T component, Converter converter, List<SelectItem> selectItems,
                String valueOrLabel, boolean byValue) {

        for (int i = 0; i < selectItems.size(); i++) {
            SelectItem item = selectItems.get(i);
            if (item instanceof SelectItemGroup) {
                SelectItemGroup selectItemGroup = (SelectItemGroup) item;
                if (selectItemGroup.getSelectItems() != null) {
                    SelectItem foundValue = findSelectItem(fc, component, converter,
                            Arrays.asList(selectItemGroup.getSelectItems()), valueOrLabel, byValue);
                    if (foundValue != null) {
                        return foundValue;
                    }
                }
            }
            else {
                String itemString;
                if (byValue) {
                    itemString = getOptionAsString(fc, component, converter, item.getValue());
                }
                else {
                    itemString = item.getLabel();
                }
                if (Objects.equals(valueOrLabel, itemString)) {
                    return item;
                }
            }
        }

        return null;
    }
Recursive method used to find a SelectItem by its value or label.
@param fc FacesContext
@param component the current UI component to find value for
@param converter the converter for the select items
@param selectItems the List of SelectItems
@param valueOrLabel the input value/label to search for
@param byValue true if searching by value false if by label
@return either the SelectItem found or NULL if not found
primefaces/src/main/java/org/primefaces/renderkit/SelectOneRenderer.java