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

Method greatestOf

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

Returns the k greatest elements of the given iterable according to this ordering, in order from greatest to least. If there are fewer than k elements present, all will be included. The implementation does not necessarily use a stable sorting algorithm; when multiple elemen

(Iterable<E> iterable, int k)

Source from the content-addressed store, hash-verified

823 * @since 8.0
824 */
825 public <E extends T> List<E> greatestOf(Iterable<E> iterable, int k) {
826 // TODO(kevinb): see if delegation is hurting performance noticeably
827 // TODO(kevinb): if we change this implementation, add full unit tests.
828 return reverse().leastOf(iterable, k);
829 }
830
831 /**
832 * Returns the {@code k} greatest elements from the given iterator according to

Callers

nothing calls this directly

Calls 2

reverseMethod · 0.95
leastOfMethod · 0.45

Tested by

no test coverage detected