Sets the array size, leaving any values beyond the current size null. @return #items
(int newSize)
| 476 | /** Sets the array size, leaving any values beyond the current size null. |
| 477 | * @return {@link #items} */ |
| 478 | public T[] setSize (int newSize) { |
| 479 | truncate(newSize); |
| 480 | if (newSize > items.length) resize(Math.max(8, newSize)); |
| 481 | size = newSize; |
| 482 | return items; |
| 483 | } |
| 484 | |
| 485 | /** Creates a new backing array with the specified size containing the current items. */ |
| 486 | protected T[] resize (int newSize) { |