Replace the first instance of a particular value
(float value, float newValue)
| 256 | |
| 257 | /** Replace the first instance of a particular value */ |
| 258 | @SuppressWarnings("unused") |
| 259 | public boolean replaceValue(float value, float newValue) { |
| 260 | if (Float.isNaN(value)) { |
| 261 | for (int i = 0; i < count; i++) { |
| 262 | if (Float.isNaN(data[i])) { |
| 263 | data[i] = newValue; |
| 264 | return true; |
| 265 | } |
| 266 | } |
| 267 | } else { |
| 268 | int index = index(value); |
| 269 | if (index != -1) { |
| 270 | data[index] = newValue; |
| 271 | return true; |
| 272 | } |
| 273 | } |
| 274 | return false; |
| 275 | } |
| 276 | |
| 277 | |
| 278 | /** Replace all instances of a particular value */ |