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

10
LINES

< > BotCompany Repo | #1036154 // addToArrayWithDoublingStrategy

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

Transpiled version (9263L) is out of date.

meta-for double also as float, long {
  static double[] addToArrayWithDoublingStrategy(double[] array, int currentSize, double element) {
    if (currentSize >= l(array)) {
      array = resizeArray(array, max(1, limitToSafeArraySize(l(array)*2L)));
      if (currentSize >= l(array)) fail("Can't handle more than 2 billion elements at once");
    }
    array[currentSize++] = element;
    ret array;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj

No comments. add comment

Snippet ID: #1036154
Snippet name: addToArrayWithDoublingStrategy
Eternal ID of this version: #1036154/5
Text MD5: 2c06f6e181b5595943af2dc030cb22ff
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-03 19:27:28
Source code size: 415 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 133 / 186
Version history: 4 change(s)
Referenced in: [show references]