Returns an immutable list containing elements sorted by this ordering. The input is not modified. Unlike Sets#newTreeSet(Iterable), this method does not discard elements that are duplicates according to the comparator. The sort performed is stable , meaning that such
(Iterable<E> elements)
| 903 | */ |
| 904 | |
| 905 | @CanIgnoreReturnValue // TODO(kak): Consider removing this |
| 906 | public <E extends T> ImmutableList<E> immutableSortedCopy(Iterable<E> elements) { |
| 907 | @SuppressWarnings("unchecked") // we'll only ever have E's in here |
| 908 | E[] array = (E[]) Iterables.toArray(elements); |
| 909 | for (E e : array) { |
| 910 | checkNotNull(e); |
| 911 | } |
| 912 | Arrays.sort(array, this); |
| 913 | return ImmutableList.asImmutableList(array); |
| 914 | } |
| 915 | |
| 916 | /** |
| 917 | * Returns {@code true} if each element in {@code iterable} after the first is |
no test coverage detected