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

22
LINES

< > BotCompany Repo | #1024797 // iterateUpdatingProgressBar

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

Libraryless. Click here for Pure Java version (2240L/14K).

static <A> ItIt<A> iterateUpdatingProgressBar(JProgressBar progressBar, Collection<A> l) {
  if (progressBar == null) ret iterableIterator(l);
  ret iteratorFromFunction_withEndMarker_f0(new F0 {
    int n = l(l), i;
    Iterator<A> it = iterator(l);
    NotTooOften nto = onlyTenTimesASecond();
    
    public O get() {
      if (!it.hasNext()) {
        setProgressBarValue(progressBar, n, n);
        setProgressBarText(progressBar, n + " / " + n);
        ret endMarker();
      }
      if (nto.yo()) {
        setProgressBarValue(progressBar, i, n);
        setProgressBarText(progressBar, i + " / " + n);
      }
      ++i;
      ret it.next();
    }
  });
}

Author comment

Began life as a copy of #1020973

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1024797
Snippet name: iterateUpdatingProgressBar
Eternal ID of this version: #1024797/6
Text MD5: 65cb0c74e200fff195eaa1b0af704d83
Transpilation MD5: 88a26bb191f0ede56c6b6a011912c36c
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-25 20:59:01
Source code size: 686 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 255 / 377
Version history: 5 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1027232 - iterateUpdatingProgressShower