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

11
LINES

< > BotCompany Repo | #1011615 // chainIterators

JavaX fragment (include)

static <A> Iterator<A> chainIterators(Collection<Iterator<A>> l) {
  final L<Iterator<A>> _l = new LinkedList(l);
  ret iteratorFromFunction(func -> A {
    while (nempty(_l)) {
      if (first(_l).hasNext())
        ret first(_l).next();
      _l.remove(0);
    }
    null;
  });
}

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: 332 / 376
Version history: 4 change(s)
Referenced in: [show references]