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

14
LINES

< > BotCompany Repo | #1019088 // iterate_printProgress - iterate and print progress count

JavaX fragment (include)

1  
static <A> IterableIterator<A> iterate_printProgress(final Collection<A> l) {
2  
  ret iff(new F0 {
3  
    int n = l(l), i;
4  
    Iterator<A> it = iterator(l);
5  
    NotTooOften nto = onlyEverySecond();
6  
    
7  
    public O get() {
8  
      if (!it.hasNext()) ret endMarker();
9  
      if (i > 0 && nto.yo()) print("Progress: " + i + "/" + n);
10  
      ++i;
11  
      ret it.next();
12  
    }
13  
  });
14  
}

Author comment

Began life as a copy of #1014419

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019088
Snippet name: iterate_printProgress - iterate and print progress count
Eternal ID of this version: #1019088/2
Text MD5: e37d8c938f9bcaf7c9ae5f0fcc7a83a5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-10-23 12:49:39
Source code size: 383 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 307 / 340
Version history: 1 change(s)
Referenced in: [show references]