Inserts the specified number of items at the specified index. The new items will have values equal to the values at those indices before the insertion.
(int index, int count)
| 194 | /** Inserts the specified number of items at the specified index. The new items will have values equal to the values at those |
| 195 | * indices before the insertion. */ |
| 196 | public void insertRange (int index, int count) { |
| 197 | if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size); |
| 198 | int sizeNeeded = size + count; |
| 199 | if (sizeNeeded > items.length) items = resize(Math.max(Math.max(8, sizeNeeded), (int)(size * 1.75f))); |
| 200 | System.arraycopy(items, index, items, index + count, size - index); |
| 201 | size = sizeNeeded; |
| 202 | } |
| 203 | |
| 204 | public void swap (int first, int second) { |
| 205 | if (first >= size) throw new IndexOutOfBoundsException("first can't be >= size: " + first + " >= " + size); |