Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

12
LINES

< > BotCompany Repo | #1031061 // isSortedListByComparator

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (49L/1K).

static <A> bool isSortedListByComparator(Cl<A> l, Comparator<A> cmp) {
  Iterator<A> it = iterator(l);
  if (!it.hasNext()) true;
  A a = it.next();
  while (it.hasNext()) {
    A b = it.next(); 
    if (cmp.compare(a, b) > 0)
      false;
    a = b;
  }
  true;
}

Author comment

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: 144 / 189
Version history: 1 change(s)
Referenced in: [show references]