Libraryless. Click here for Pure Java version (9468L/52K).
1 | static float[] removePlateausFromArray(float[] array) { |
2 | if (array == null) null; |
3 | FloatBuffer buf = new(array.length); |
4 | for (int i = 0; i < array.length; i++) { |
5 | var value = array[i]; |
6 | buf.add(value); |
7 | while (i+1 < array.length && array[i+1] == value) ++i; |
8 | } |
9 | ret l(buf) == array.length ? array : buf.toArray(); |
10 | } |
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: | 158 / 209 |
Version history: | 1 change(s) |
Referenced in: | [show references] |