public static <C extends Comparable<?>> Range<C> encloseAll(Iterable<C> values) {
    """
	Returns the minimal range that {@linkplain Range#contains(Comparable) contains} all of the
	given values. The returned range is {@linkplain BoundType#CLOSED closed} on both ends.
	
	@throws ClassCastException if the values are not mutually comparable
	@throws NoSuchElementException if {@code values} is empty
	@throws NullPointerException if any of {@code values} is null
	@since 14.0
    """
    checkNotNull(values);
    if (values instanceof SortedSet) {
      SortedSet<? extends C> set = cast(values);
      Comparator<?> comparator = set.comparator();
      if (Ordering.natural().equals(comparator) || comparator == null) {
        return closed(set.first(), set.last());
      }
    }
    Iterator<C> valueIterator = values.iterator();
    C min = checkNotNull(valueIterator.next());
    C max = min;
    while (valueIterator.hasNext()) {
      C value = checkNotNull(valueIterator.next());
      min = Ordering.natural().min(min, value);
      max = Ordering.natural().max(max, value);
    }
    return closed(min, max);
  }
public static <C extends Comparable<?>> Range<C> encloseAll(Iterable<C> values) {
    checkNotNull(values);
    if (values instanceof SortedSet) {
      SortedSet<? extends C> set = cast(values);
      Comparator<?> comparator = set.comparator();
      if (Ordering.natural().equals(comparator) || comparator == null) {
        return closed(set.first(), set.last());
      }
    }
    Iterator<C> valueIterator = values.iterator();
    C min = checkNotNull(valueIterator.next());
    C max = min;
    while (valueIterator.hasNext()) {
      C value = checkNotNull(valueIterator.next());
      min = Ordering.natural().min(min, value);
      max = Ordering.natural().max(max, value);
    }
    return closed(min, max);
  }
public static < C extends Comparable < ? > > Range < C > encloseAll ( Iterable < C > values ) { checkNotNull ( values ) ; if ( values instanceof SortedSet ) { SortedSet < ? extends C > set = cast ( values ) ; Comparator < ? > comparator = set . comparator ( ) ; if ( Ordering . natural ( ) . equals ( comparator ) || comparator == null ) { return closed ( set . first ( ) , set . last ( ) ) ; } } Iterator < C > valueIterator = values . iterator ( ) ; C min = checkNotNull ( valueIterator . next ( ) ) ; C max = min ; while ( valueIterator . hasNext ( ) ) { C value = checkNotNull ( valueIterator . next ( ) ) ; min = Ordering . natural ( ) . min ( min , value ) ; max = Ordering . natural ( ) . max ( max , value ) ; } return closed ( min , max ) ; }
Returns the minimal range that {@linkplain Range#contains(Comparable) contains} all of the
given values. The returned range is {@linkplain BoundType#CLOSED closed} on both ends.

@throws ClassCastException if the values are not mutually comparable
@throws NoSuchElementException if {@code values} is empty
@throws NullPointerException if any of {@code values} is null
@since 14.0
Returns the minimal range that { @linkplain Range#contains ( Comparable ) contains } all of the given values . The returned range is { @linkplain BoundType#CLOSED closed } on both ends .