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

14
LINES

< > BotCompany Repo | #1011921 // chunksOf1000

JavaX fragment (include)

1  
static <A> LL<A> chunksOf1000(Collection<A> c) {
2  
  new LL<A> out;
3  
  Iterator<A> it = iterator(c);
4  
  L<A> l = new L(1000);
5  
  while (it.hasNext()) {
6  
    l.add(it.next());
7  
    if (l(l) >= 1000) {
8  
      out.add(l);
9  
      l = new L(1000);
10  
    }
11  
  }
12  
  if (nempty(l)) out.add(l);
13  
  ret out;
14  
}

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: #1011921
Snippet name: chunksOf1000
Eternal ID of this version: #1011921/3
Text MD5: a670c237747c8baa16825b7ae69645d2
Author: stefan
Category: javax / collections
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-10 03:18:21
Source code size: 298 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 399 / 435
Version history: 2 change(s)
Referenced in: [show references]