code: public static <C extends Comparable> ImmutableRangeSet<C> copyOf(RangeSet<C> rangeSet) {
      checkNotNull(rangeSet);
      if (rangeSet.isEmpty()) {
        return of();
      } else if (rangeSet.encloses(Range.<C>all())) {
        return all();
      }
  
      if (rangeSet instanceof ImmutableRangeSet) {
        ImmutableRangeSet<C> immutableRangeSet = (ImmutableRangeSet<C>) rangeSet;
        if (!immutableRangeSet.isPartialView()) {
          return immutableRangeSet;
        }
      }
      return new ImmutableRangeSet<C>(ImmutableList.copyOf(rangeSet.asRanges()));
    }
docs: Returns an immutable copy of the specified {@code RangeSet}.