| 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 |