android/guava/src/com/google/common/collect/ImmutableList.java
public static <E extends Comparable<? super E>> ImmutableList<E> sortedCopyOf(
      Iterable<? extends E> elements) {
    Comparable<?>[] array = Iterables.toArray(elements, new Comparable<?>[0]);
    checkElementsNotNull((Object[]) array);
    Arrays.sort(array);
    return asImmutableList(array);
  }
public static <E extends Comparable<? super E>> ImmutableList<E> sortedCopyOf(
      Iterable<? extends E> elements) {
    Comparable<?>[] array = Iterables.toArray(elements, new Comparable<?>[0]);
    checkElementsNotNull((Object[]) array);
    Arrays.sort(array);
    return asImmutableList(array);
  }
public static < E extends Comparable < ? super E > > ImmutableList < E > sortedCopyOf ( Iterable < ? extends E > elements ) { Comparable < ? > [ ] array = Iterables . toArray ( elements , new Comparable < ? > [ 0 ] ) ; checkElementsNotNull ( ( Object [ ] ) array ) ; Arrays . sort ( array ) ; return asImmutableList ( array ) ; }
Returns an immutable list containing the given elements, sorted according to their natural
order. The sorting algorithm used is stable, so elements that compare as equal will stay in the
order in which they appear in the input.

<p>If your data has no duplicates, or you wish to deduplicate elements, use {@code
ImmutableSortedSet.copyOf(elements)}; if you want a {@code List} you can use its {@code
asList()} view.

<p><b>Java 8 users:</b> If you want to convert a {@link java.util.stream.Stream} to a sorted
{@code ImmutableList}, use {@code stream.sorted().collect(toImmutableList())}.

@throws NullPointerException if any element in the input is null
@since 21.0
Returns an immutable list containing the given elements sorted according to their natural order . The sorting algorithm used is stable so elements that compare as equal will stay in the order in which they appear in the input .