/** Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items have * been removed, or if it is known that more items will not be added. */ public void shrink () { resize(size); }
/** Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items * have been removed, or if it is known that more items will not be added. */ public void shrink () { resize(size); }
/** Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items * have been removed, or if it is known that more items will not be added. */ public void shrink () { resize(size); }
/** Reduces the size of the backing array to the size of the actual items. This is useful to release memory when many items have * been removed, or if it is known that more items will not be added. */ public void shrink () { resize(size); }
public void add (int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); items[size++] = value; }
/** Increases the size of the backing array to acommodate the specified number of additional items. Useful before adding many * items to avoid multiple backing array resizes. * @return {@link #items} */ public int[] ensureCapacity (int additionalCapacity) { int sizeNeeded = size + additionalCapacity; if (sizeNeeded >= items.length) resize(Math.max(8, sizeNeeded)); return items; }
public void add (int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); items[size++] = value; }
/** Increases the size of the backing array to acommodate the specified number of additional items. Useful before adding many * items to avoid multiple backing array resizes. * @return {@link #items} */ public int[] ensureCapacity (int additionalCapacity) { int sizeNeeded = size + additionalCapacity; if (sizeNeeded >= items.length) resize(Math.max(8, sizeNeeded)); return items; }
public void add (int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); items[size++] = value; }
/** Increases the size of the backing array to acommodate the specified number of additional items. Useful before adding many * items to avoid multiple backing array resizes. * @return {@link #items} */ public int[] ensureCapacity (int additionalCapacity) { int sizeNeeded = size + additionalCapacity; if (sizeNeeded >= items.length) resize(Math.max(8, sizeNeeded)); return items; }
/** Increases the size of the backing array to acommodate the specified number of additional items. Useful before adding many * items to avoid multiple backing array resizes. * @return {@link #items} */ public int[] ensureCapacity (int additionalCapacity) { int sizeNeeded = size + additionalCapacity; if (sizeNeeded >= items.length) resize(Math.max(8, sizeNeeded)); return items; }
public void add (int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); items[size++] = value; }
public void insert (int index, int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); if (ordered) System.arraycopy(items, index, items, index + 1, size - index); else items[size] = items[index]; size++; items[index] = value; }
public void insert (int index, int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); if (ordered) System.arraycopy(items, index, items, index + 1, size - index); else items[size] = items[index]; size++; items[index] = value; }
public void addAll (int[] array, int offset, int length) { int[] items = this.items; int sizeNeeded = size + length - offset; if (sizeNeeded >= items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f))); System.arraycopy(array, offset, items, size, length); size += length; }
public void addAll (int[] array, int offset, int length) { int[] items = this.items; int sizeNeeded = size + length - offset; if (sizeNeeded >= items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f))); System.arraycopy(array, offset, items, size, length); size += length; }
public void addAll (int[] array, int offset, int length) { int[] items = this.items; int sizeNeeded = size + length - offset; if (sizeNeeded >= items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f))); System.arraycopy(array, offset, items, size, length); size += length; }
public void insert (int index, int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); if (ordered) System.arraycopy(items, index, items, index + 1, size - index); else items[size] = items[index]; size++; items[index] = value; }
public void addAll (int[] array, int offset, int length) { int[] items = this.items; int sizeNeeded = size + length - offset; if (sizeNeeded >= items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f))); System.arraycopy(array, offset, items, size, length); size += length; }
public void insert (int index, int value) { int[] items = this.items; if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f))); if (ordered) System.arraycopy(items, index, items, index + 1, size - index); else items[size] = items[index]; size++; items[index] = value; }