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

Method sortedCopy

output/java_guava/1.4.18/Ordering.java:878–884  ·  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

876 */
877
878 @CanIgnoreReturnValue // TODO(kak): Consider removing this
879 public <E extends T> List<E> sortedCopy(Iterable<E> elements) {
880 @SuppressWarnings("unchecked") // does not escape, and contains only E's
881 E[] array = (E[]) Iterables.toArray(elements);
882 Arrays.sort(array, this);
883 return Lists.newArrayList(Arrays.asList(array));
884 }
885
886 /**
887 * 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