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

11
LINES

< > BotCompany Repo | #1020680 // listToChunks

JavaX fragment (include)

static <A> LL<A> listToChunks(L<A> l, int chunkSize) {
  int rows = intRatio_ceil(l(l), chunkSize);
  LL<A> out = emptyList(rows);
  for y to rows:
    out.add(subList(l, y*chunkSize, (y+1)*chunkSize));
  ret out;
}

static <A> LL<A> listToChunks(int chunkSize, L<A> l) {
  ret listToChunks(l, chunkSize);
}

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: 249 / 309
Version history: 1 change(s)
Referenced in: [show references]