| 220 | |
| 221 | // Remove all instances of a particular value and return the count removed. |
| 222 | @SuppressWarnings("unused") |
| 223 | public int removeValues(String value) { |
| 224 | int ii = 0; |
| 225 | if (value == null) { |
| 226 | for (int i = 0; i < count; i++) { |
| 227 | if (data[i] != null) { |
| 228 | data[ii++] = data[i]; |
| 229 | } |
| 230 | } |
| 231 | } else { |
| 232 | for (int i = 0; i < count; i++) { |
| 233 | if (!value.equals(data[i])) { |
| 234 | data[ii++] = data[i]; |
| 235 | } |
| 236 | } |
| 237 | } |
| 238 | int removed = count - ii; |
| 239 | count = ii; |
| 240 | return removed; |
| 241 | } |
| 242 | |
| 243 | |
| 244 | // replace the first value that matches, return the index that was replaced |