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

8
LINES

< > BotCompany Repo | #1005524 // shortenList - shorten list to n elements (using subList)

JavaX fragment (include)

static <A> L<A> shortenList(int max, L<A> l) {
  if (l(l) <= max) ret l;
  ret subList(l, 0, max);
}

static <A> L<A> shortenList(L<A> l, int max) {
  ret shortenList(max, l);
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005524
Snippet name: shortenList - shorten list to n elements (using subList)
Eternal ID of this version: #1005524/1
Text MD5: 079b8f27a7aa91de0d158e9d6f898486
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-11-29 01:24:51
Source code size: 186 bytes / 8 lines
Pitched / IR pitched: No / No
Views / Downloads: 525 / 543
Referenced in: [show references]