android/guava/src/com/google/common/collect/ImmutableRangeSet.java
public static <C extends Comparable<?>> ImmutableRangeSet<C> copyOf(Iterable<Range<C>> ranges) {
    return new ImmutableRangeSet.Builder<C>().addAll(ranges).build();
  }
public static <C extends Comparable<?>> ImmutableRangeSet<C> copyOf(Iterable<Range<C>> ranges) {
    return new ImmutableRangeSet.Builder<C>().addAll(ranges).build();
  }
Returns an {@code ImmutableRangeSet} containing each of the specified disjoint ranges.
Overlapping ranges and empty ranges are forbidden, though adjacent ranges are permitted and
will be merged.

@throws IllegalArgumentException if any ranges overlap or are empty
@since 21.0