private Set<String> toStringSet(Object obj) {

        // Consider null to represent no provided values
        if (obj == null)
            return Collections.emptySet();

        // If the provided object is already a Collection, produce a Collection
        // where we know for certain that all values are Strings
        if (obj instanceof Collection) {
            return ((Collection<?>) obj).stream()
                    .map(Object::toString)
                    .collect(Collectors.toSet());
        }

        // Otherwise, assume we have only a single value
        return Collections.singleton(obj.toString());

    }
Converts the given CAS attribute value object (whose type is variable)
to a Set of String values. If the value is already a Collection of some
kind, its values are converted to Strings and returned as the members of
the Set. If the value is not already a Collection, it is assumed to be a
single value, converted to a String, and used as the sole member of the
set.

@param obj
    The CAS attribute value to convert to a Set of Strings.

@return
    A Set of all String values contained within the given CAS attribute
    value.
extensions/guacamole-auth-sso/modules/guacamole-auth-sso-cas/src/main/java/org/apache/guacamole/auth/cas/ticket/TicketValidationService.java