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

15
LINES

< > BotCompany Repo | #1022294 // iterateOverListSendingPercentage

JavaX fragment (include)

1  
// onPercentage: voidfunc(Number)
2  
static <A> ItIt<A> iterateOverListSendingPercentage(O onPercentage, L<A> l) {
3  
  ret iff(new O {
4  
    int n = l(l), i = 0, lastPercent = 0;
5  
    
6  
    public O get() {
7  
      if (i >= n) ret endMarker();
8  
      O o = l.get(i++);
9  
      int percent = intPercentRatio(i, n);
10  
      if (percent > lastPercent)
11  
        pcallF(onPercentage, lastPercent = percent);
12  
      ret o;
13  
    }
14  
  });
15  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022294
Snippet name: iterateOverListSendingPercentage
Eternal ID of this version: #1022294/3
Text MD5: 44bdab2b1aca39c953946557828a74c6
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-03-12 20:43:41
Source code size: 426 bytes / 15 lines
Pitched / IR pitched: No / No
Views / Downloads: 232 / 268
Version history: 2 change(s)
Referenced in: [show references]