code: public static <T> Set<T> toImmutableSet(final Set<? extends T> set) {
      switch (set.size()) {
        case 0:
          return Collections.emptySet();
        case 1:
          return Collections.singleton(set.iterator().next());
        default:
          return Collections.unmodifiableSet(set);
      }
    }
docs: list to imuteable set.
  
  @param set set to convert
  @return imuteable set