Remove an element from the specified index. @webref floatlist:method @webBrief Remove an element from the specified index
(int index)
| 198 | * @webBrief Remove an element from the specified index |
| 199 | */ |
| 200 | public float remove(int index) { |
| 201 | if (index < 0 || index >= count) { |
| 202 | throw new ArrayIndexOutOfBoundsException(index); |
| 203 | } |
| 204 | float entry = data[index]; |
| 205 | // int[] outgoing = new int[count - 1]; |
| 206 | // System.arraycopy(data, 0, outgoing, 0, index); |
| 207 | // count--; |
| 208 | // System.arraycopy(data, index + 1, outgoing, 0, count - index); |
| 209 | // data = outgoing; |
| 210 | // For most cases, this actually appears to be faster |
| 211 | // than arraycopy() on an array copying into itself. |
| 212 | for (int i = index; i < count-1; i++) { |
| 213 | data[i] = data[i+1]; |
| 214 | } |
| 215 | count--; |
| 216 | return entry; |
| 217 | } |
| 218 | |
| 219 | |
| 220 | // Remove the first instance of a particular value, |
no outgoing calls
no test coverage detected