code: public static Set getSelectedValuesAsSet(FacesContext context,
              UIComponent component, Converter converter,
              UISelectMany uiSelectMany)
      {
          Object selectedValues = uiSelectMany.getValue();
  
          return internalSubmittedOrSelectedValuesAsSet(context, component,
                  converter, uiSelectMany, selectedValues, true);
      }
docs: Convenient utility method that returns the currently selected values of
  a UISelectMany component as a Set, of which the contains method can then be
  easily used to determine if a value is currently selected.
  Calling the contains method of this Set with the item value
  as argument returns true if this item is selected.
  @param uiSelectMany
  @return Set containing all currently selected values