| 249 | |
| 250 | // replace the first value that matches, return the index that was replaced |
| 251 | public int replaceValue(String value, String newValue) { |
| 252 | if (value == null) { |
| 253 | for (int i = 0; i < count; i++) { |
| 254 | if (data[i] == null) { |
| 255 | data[i] = newValue; |
| 256 | return i; |
| 257 | } |
| 258 | } |
| 259 | } else { |
| 260 | for (int i = 0; i < count; i++) { |
| 261 | if (value.equals(data[i])) { |
| 262 | data[i] = newValue; |
| 263 | return i; |
| 264 | } |
| 265 | } |
| 266 | } |
| 267 | return -1; |
| 268 | } |
| 269 | |
| 270 | |
| 271 | // replace all values that match, return the count of those replaced |