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

Method isStrictlyOrdered

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

Returns true if each element in iterable after the first is strictly greater than the element that preceded it, according to this ordering. Note that this is always true when the iterable has fewer than two elements.

(Iterable<? extends T> iterable)

Source from the content-addressed store, hash-verified

929 * than two elements.
930 */
931 public boolean isStrictlyOrdered(Iterable<? extends T> iterable) {
932 Iterator<? extends T> it = iterable.iterator();
933 if (it.hasNext()) {
934 T prev = it.next();
935 while (it.hasNext()) {
936 T next = it.next();
937 if (compare(prev, next) >= 0) {
938 return false;
939 }
940 prev = next;
941 }
942 }
943 return true;
944 }
945
946 /**
947 * {@link Collections#binarySearch(List, Object, Comparator) Searches}

Callers

nothing calls this directly

Calls 4

compareMethod · 0.95
iteratorMethod · 0.65
nextMethod · 0.65
hasNextMethod · 0.45

Tested by

no test coverage detected