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)

static <A> IterableIterator<A> iterate_printProgress(final Collection<A> l) {
  ret iff(new F0 {
    int n = l(l), i;
    Iterator<A> it = iterator(l);
    NotTooOften nto = onlyEverySecond();
    
    public O get() {
      if (!it.hasNext()) ret endMarker();
      if (i > 0 && nto.yo()) print("Progress: " + i + "/" + n);
      ++i;
      ret it.next();
    }
  });
}

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: 306 / 339
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1020973 - iterate_progressWindow - iterate and show a progress window. make sure to dispose it properly (use temp statement)