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)

1  
static <A> L<A> shortenList(int max, L<A> l) {
2  
  if (l(l) <= max) ret l;
3  
  ret subList(l, 0, max);
4  
}
5  
6  
static <A> L<A> shortenList(L<A> l, int max) {
7  
  ret shortenList(max, l);
8  
}

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: 526 / 544
Referenced in: [show references]