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

13
LINES

< > BotCompany Repo | #1030423 // sortedPercentage - how sorted is a list?

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

Transpiled version (2955L) is out of date.

1  
static <A> double sortedPercentage(Cl<A> l, Comparator<A> comparator default null) {
2  
  new Scorer scorer;
3  
  Iterator<A> it = iterator(l);
4  
  if (it.hasNext()) {
5  
    A a = it.next();
6  
    while (it.hasNext()) {
7  
      A b = it.next(); 
8  
      scorer.add(compareWithComparator(comparator, a, b) <= 0);
9  
      a = b;
10  
    }
11  
  }
12  
  ret scorer.percentScore();
13  
}

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: #1030423
Snippet name: sortedPercentage - how sorted is a list?
Eternal ID of this version: #1030423/5
Text MD5: d6ed5195bb3471db4e1892b859b4caea
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-15 18:37:57
Source code size: 361 bytes / 13 lines
Pitched / IR pitched: No / No
Views / Downloads: 198 / 281
Version history: 4 change(s)
Referenced in: [show references]