MCPcopy Index your code
hub / github.com/benfry/processing4 / replaceValue

Method replaceValue

core/src/processing/data/StringList.java:245–263  ·  view source on GitHub ↗
(String value, String newValue)

Source from the content-addressed store, hash-verified

243
244 // replace the first value that matches, return the index that was replaced
245 @SuppressWarnings("unused")
246 public int replaceValue(String value, String newValue) {
247 if (value == null) {
248 for (int i = 0; i < count; i++) {
249 if (data[i] == null) {
250 data[i] = newValue;
251 return i;
252 }
253 }
254 } else {
255 for (int i = 0; i < count; i++) {
256 if (value.equals(data[i])) {
257 data[i] = newValue;
258 return i;
259 }
260 }
261 }
262 return -1;
263 }
264
265
266 // replace all values that match, return the count of those replaced

Callers

nothing calls this directly

Calls 1

equalsMethod · 0.45

Tested by

no test coverage detected