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

11
LINES

< > BotCompany Repo | #1011615 // chainIterators

JavaX fragment (include)

1  
static <A> Iterator<A> chainIterators(Collection<Iterator<A>> l) {
2  
  final L<Iterator<A>> _l = new LinkedList(l);
3  
  ret iteratorFromFunction(func -> A {
4  
    while (nempty(_l)) {
5  
      if (first(_l).hasNext())
6  
        ret first(_l).next();
7  
      _l.remove(0);
8  
    }
9  
    null;
10  
  });
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1011615
Snippet name: chainIterators
Eternal ID of this version: #1011615/5
Text MD5: a6d49ab9d4749f098af988568ce07f63
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-11 15:35:49
Source code size: 292 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 337 / 383
Version history: 4 change(s)
Referenced in: [show references]