code: public static <T> Set<T> immutableSetView(Set<T> set) {
          if (set instanceof ImmutableSet<?>) {
              return set;
          }
          return Collections.unmodifiableSet(set);
      }
docs: Returns an immutable view of a given set. If the given set is empty, a shared instance is returned. If the given set is
  an instance of {@link ArraySet}, it is trimmed.