Returns true if the specified value was replaced successfully with the replacement @param value the char to be replaced @param replacement the first value will be replaced by this replacement if found @return if value was found and replaced
(char value, char replacement)
| 244 | * @param replacement the first value will be replaced by this replacement if found |
| 245 | * @return if value was found and replaced */ |
| 246 | public boolean replaceFirst (char value, char replacement) { |
| 247 | if (value != replacement) { |
| 248 | char[] items = this.items; |
| 249 | for (int i = 0, n = size; i < n; i++) { |
| 250 | if (items[i] == value) { |
| 251 | items[i] = replacement; |
| 252 | return true; |
| 253 | } |
| 254 | } |
| 255 | } |
| 256 | return false; |
| 257 | } |
| 258 | |
| 259 | /** Returns the number of replacements done. |
| 260 | * @param value the char to be replaced |