Libraryless. Click here for Pure Java version (49L/1K).
1 | static <A> bool isSortedListByComparator(Cl<A> l, Comparator<A> cmp) { |
2 | Iterator<A> it = iterator(l); |
3 | if (!it.hasNext()) true; |
4 | A a = it.next(); |
5 | while (it.hasNext()) { |
6 | A b = it.next(); |
7 | if (cmp.compare(a, b) > 0) |
8 | false; |
9 | a = b; |
10 | } |
11 | true; |
12 | } |
Began life as a copy of #1005380
download show line numbers debug dex old transpilations
Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt
No comments. add comment
Snippet ID: | #1031061 |
Snippet name: | isSortedListByComparator |
Eternal ID of this version: | #1031061/2 |
Text MD5: | 458a547aac628741d4d32544bc957f80 |
Transpilation MD5: | 0dfdb43d57e9628372d4a4dd194e7c99 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-04-26 17:15:19 |
Source code size: | 275 bytes / 12 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 218 / 282 |
Version history: | 1 change(s) |
Referenced in: | [show references] |