MCPcopy Create free account
hub / github.com/antlr/codebuff / sortedCopy

Method sortedCopy

corpus/java/training/guava/collect/Ordering.java:867–873  ·  view source on GitHub ↗

Returns a mutable list containing elements sorted by this ordering; use this only when the resulting list may need further modification, or may contain null. The input is not modified. The returned list is serializable and has random access. Unlike {@link Sets#newTreeSet(I

(Iterable<E> elements)

Source from the content-addressed store, hash-verified

865 * Collections#sort(List)}.
866 */
867 @CanIgnoreReturnValue // TODO(kak): Consider removing this
868 public <E extends T> List<E> sortedCopy(Iterable<E> elements) {
869 @SuppressWarnings("unchecked") // does not escape, and contains only E's
870 E[] array = (E[]) Iterables.toArray(elements);
871 Arrays.sort(array, this);
872 return Lists.newArrayList(Arrays.asList(array));
873 }
874
875 /**
876 * Returns an <b>immutable</b> list containing {@code elements} sorted by this

Callers 1

preferringStringsMethod · 0.45

Calls 4

toArrayMethod · 0.95
newArrayListMethod · 0.95
sortMethod · 0.80
asListMethod · 0.45

Tested by

no test coverage detected