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

Method isOrdered

output/java_guava/1.4.17/Ordering.java:924–937  ·  view source on GitHub ↗

Returns true if each element in iterable after the first is greater than or equal to 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

922
923
924 public boolean isOrdered(Iterable<? extends T> iterable) {
925 Iterator<? extends T> it = iterable.iterator();
926 if (it.hasNext()) {
927 T prev = it.next();
928 while (it.hasNext()) {
929 T next = it.next();
930 if (compare(prev, next) > 0) {
931 return false;
932 }
933 prev = next;
934 }
935 }
936 return true;
937 }
938
939 /**
940 * Returns {@code true} if each element in {@code iterable} after the first is

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