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

7
LINES

< > BotCompany Repo | #1030557 // repeatList - repeats list n times

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2702L/16K).

1  
static <A> L<A> repeatList(int n, Cl<A> l) {
2  
  if (n <= 0) ret emptyList();
3  
  if (n == 1) ret asList(l);
4  
  L<A> out = emptyList(n*l(l));
5  
  repeat n { out.addAll(l); }
6  
  ret out;
7  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 4 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, vouqrxazstgt

No comments. add comment

Snippet ID: #1030557
Snippet name: repeatList - repeats list n times
Eternal ID of this version: #1030557/1
Text MD5: 79b9befb6705b9882f94152c256ea542
Transpilation MD5: 27c3eeed1ddada9e466f0870eddc1003
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2021-01-07 18:18:33
Source code size: 185 bytes / 7 lines
Pitched / IR pitched: No / No
Views / Downloads: 181 / 254
Referenced in: [show references]