| 180 | } |
| 181 | |
| 182 | public void insert (int index, T value) { |
| 183 | if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size); |
| 184 | T[] items = this.items; |
| 185 | if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); |
| 186 | if (ordered) |
| 187 | System.arraycopy(items, index, items, index + 1, size - index); |
| 188 | else |
| 189 | items[size] = items[index]; |
| 190 | size++; |
| 191 | items[index] = value; |
| 192 | } |
| 193 | |
| 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. */ |