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)
| 945 | |
| 946 | |
| 947 | public boolean isStrictlyOrdered(Iterable<? extends T> iterable) { |
| 948 | Iterator<? extends T> it = iterable.iterator(); |
| 949 | if (it.hasNext()) { |
| 950 | T prev = it.next(); |
| 951 | while (it.hasNext()) { |
| 952 | T next = it.next(); |
| 953 | if (compare(prev, next) >= 0) { |
| 954 | return false; |
| 955 | } |
| 956 | prev = next; |
| 957 | } |
| 958 | } |
| 959 | return true; |
| 960 | } |
| 961 | |
| 962 | /** |
| 963 | * {@link Collections#binarySearch(List, Object, Comparator) Searches} |