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

11
LINES

< > BotCompany Repo | #1020680 // listToChunks

JavaX fragment (include)

1  
static <A> LL<A> listToChunks(L<A> l, int chunkSize) {
2  
  int rows = intRatio_ceil(l(l), chunkSize);
3  
  LL<A> out = emptyList(rows);
4  
  for y to rows:
5  
    out.add(subList(l, y*chunkSize, (y+1)*chunkSize));
6  
  ret out;
7  
}
8  
9  
static <A> LL<A> listToChunks(int chunkSize, L<A> l) {
10  
  ret listToChunks(l, chunkSize);
11  
}

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: #1020680
Snippet name: listToChunks
Eternal ID of this version: #1020680/2
Text MD5: 976cb89bcc99d3b8c34abfb95a69c4b0
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-08-28 16:28:51
Source code size: 313 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 251 / 312
Version history: 1 change(s)
Referenced in: [show references]