public static <T> Set<T> copyOf(Set<T> set) {
        if (isUnmodifiableType(set.getClass())) {
            return set;
        } else {
            return new HashSet<>(set);
        }
    }
Return an unmodifiable copy of a set, or the same set if its already an unmodifiable type.

@param set the set
@param <T> element type
@return unmodifiable copy of a set, or the same set if its already an unmodifiable type
querydsl-core/src/main/java/com/querydsl/core/util/CollectionUtils.java