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)

static <A> void listSet(L<A> l, int i, A a, A emptyElement) {
  if (i < 0) ret;
  while (i >= l(l)) l.add(emptyElement);
  l.set(i, a);
}

static <A> void listSet(L<A> l, int i, A a) {
  listSet(l, i, a, null);
}

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: 617 / 623
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1008948 - listPut - synonym of listSet - combined add or set for list
#1023724 - setFirstAndLast
#1028453 - listSetIfInRange