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

10
LINES

< > BotCompany Repo | #1036155 // removePlateausFromArray

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

Libraryless. Click here for Pure Java version (9468L/52K).

static float[] removePlateausFromArray(float[] array) {
  if (array == null) null;
  FloatBuffer buf = new(array.length);
  for (int i = 0; i < array.length; i++) {
    var value = array[i];
    buf.add(value);
    while (i+1 < array.length && array[i+1] == value) ++i;
  }
  ret l(buf) == array.length ? array : buf.toArray();
}

download  show line numbers  debug dex  old transpilations   

Travelled to 2 computer(s): elmgxqgtpvxh, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1036155
Snippet name: removePlateausFromArray
Eternal ID of this version: #1036155/2
Text MD5: 5e0952fe75eefc8fd505010d4b73f201
Transpilation MD5: 83e4232f56a3109c8630b1b993d529a5
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-10-01 09:45:41
Source code size: 338 bytes / 10 lines
Pitched / IR pitched: No / No
Views / Downloads: 157 / 207
Version history: 1 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)