Remove an element from the specified index @webref intlist:method @webBrief Remove an element from the specified index
(int index)
| 224 | * @webBrief Remove an element from the specified index |
| 225 | */ |
| 226 | public long remove(int index) { |
| 227 | if (index < 0 || index >= count) { |
| 228 | throw new ArrayIndexOutOfBoundsException(index); |
| 229 | } |
| 230 | long entry = data[index]; |
| 231 | // int[] outgoing = new int[count - 1]; |
| 232 | // System.arraycopy(data, 0, outgoing, 0, index); |
| 233 | // count--; |
| 234 | // System.arraycopy(data, index + 1, outgoing, 0, count - index); |
| 235 | // data = outgoing; |
| 236 | // For most cases, this actually appears to be faster |
| 237 | // than arraycopy() on an array copying into itself. |
| 238 | for (int i = index; i < count-1; i++) { |
| 239 | data[i] = data[i+1]; |
| 240 | } |
| 241 | count--; |
| 242 | return entry; |
| 243 | } |
| 244 | |
| 245 | |
| 246 | // Remove the first instance of a particular value, |
no outgoing calls
no test coverage detected