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

9
LINES

< > BotCompany Repo | #1004144 // listSet - combined add or set for list

JavaX fragment (include)

1  
static <A> void listSet(L<A> l, int i, A a, A emptyElement) {
2  
  if (i < 0) ret;
3  
  while (i >= l(l)) l.add(emptyElement);
4  
  l.set(i, a);
5  
}
6  
7  
static <A> void listSet(L<A> l, int i, A a) {
8  
  listSet(l, i, a, null);
9  
}

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: #1004144
Snippet name: listSet - combined add or set for list
Eternal ID of this version: #1004144/2
Text MD5: 7f169ddba3a1bb948d3cad8194d9b496
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-03-05 22:35:39
Source code size: 222 bytes / 9 lines
Pitched / IR pitched: No / No
Views / Downloads: 616 / 622
Version history: 1 change(s)
Referenced in: [show references]