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

6
LINES

< > BotCompany Repo | #1023055 // arraySetWithExponentialGrowth

JavaX fragment (include)

static <A> A[] arraySetWithExponentialGrowth(A[] array, int idx, A element) {
  if (idx >= l(array))
    array = (A[]) resizeArray(array, max(idx+1, iround(l(array)*1.5)));
  array[idx] = element;
  ret array;
}

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023055
Snippet name: arraySetWithExponentialGrowth
Eternal ID of this version: #1023055/4
Text MD5: 949df5f1ea8f60e9be441c0f38075278
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-29 23:16:31
Source code size: 216 bytes / 6 lines
Pitched / IR pitched: No / No
Views / Downloads: 206 / 259
Version history: 3 change(s)
Referenced in: [show references]