(Iterable<E> elements)
| 858 | */ |
| 859 | // TODO(kevinb): rerun benchmarks including new options |
| 860 | public <E extends T> List<E> sortedCopy(Iterable<E> elements) { |
| 861 | @SuppressWarnings("unchecked") // does not escape, and contains only E's |
| 862 | E[] array = (E[]) Iterables.toArray(elements); |
| 863 | sort(array, this); |
| 864 | return new ArrayList<>(asList(array)); |
| 865 | } |
| 866 | |
| 867 | /** |
| 868 | * Returns an <b>immutable</b> list containing {@code elements} sorted by this ordering. The input |