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

18
LINES

< > BotCompany Repo | #1020973 // iterate_progressWindow - iterate and show a progress window. make sure to dispose it properly (use temp statement)

JavaX fragment (include)

1  
static <A> CloseableIterableIterator<A> iterate_progressWindow(final Collection<A> l) {
2  
  final JProgressBar bar = showProgressWindow(l(l));
3  
  ret iteratorFromFunction_withEndMarker_f0_autoCloseable(new F0 {
4  
    int i;
5  
    Iterator<A> it = iterator(l);
6  
    NotTooOften nto = onlyTenTimesASecond();
7  
    
8  
    public O get() {
9  
      if (!it.hasNext()) ret endMarker();
10  
      if (i > 0 && nto.yo()) {
11  
        setProgressBarValue(bar, i);
12  
        // TODO: set window title too
13  
      }
14  
      ++i;
15  
      ret it.next();
16  
    }
17  
  }, tempDisposePIFrame(bar));
18  
}

Author comment

Began life as a copy of #1019088

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1020973
Snippet name: iterate_progressWindow - iterate and show a progress window. make sure to dispose it properly (use temp statement)
Eternal ID of this version: #1020973/4
Text MD5: 2f3f3b8f8548633f87de18bc67d23d79
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-01-15 17:00:34
Source code size: 567 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 315 / 327
Version history: 3 change(s)
Referenced in: [show references]