1 | static <A> LL<A> chunksOf(Collection<A> c, int n) { |
2 | new LL<A> out; |
3 | Iterator<A> it = iterator(c); |
4 | L<A> l = new L(n); |
5 | while (it.hasNext()) { |
6 | l.add(it.next()); |
7 | if (l(l) >= n) { |
8 | out.add(l); |
9 | l = new L(n); |
10 | } |
11 | } |
12 | if (nempty(l)) out.add(l); |
13 | ret out; |
14 | } |
Began life as a copy of #1011921
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: | #1015445 |
Snippet name: | chunksOf |
Eternal ID of this version: | #1015445/1 |
Text MD5: | bdacaa1228c328ab61bc629ddbc926b4 |
Author: | stefan |
Category: | javax / collections |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-14 01:31:21 |
Source code size: | 292 bytes / 14 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 427 / 453 |
Referenced in: | [show references] |