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).

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

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