android/guava/src/com/google/common/collect/ImmutableRangeSet.java
public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> ranges) {
    return copyOf(TreeRangeSet.create(ranges));
  }
public static <C extends Comparable<?>> ImmutableRangeSet<C> unionOf(Iterable<Range<C>> ranges) {
    return copyOf(TreeRangeSet.create(ranges));
  }
Returns an {@code ImmutableRangeSet} representing the union of the specified ranges.

<p>This is the smallest {@code RangeSet} which encloses each of the specified ranges. Duplicate
or connected ranges are permitted, and will be coalesced in the result.

@since 21.0