MCPcopy
hub / github.com/libgdx/libgdx / truncate

Method truncate

gdx/src/com/badlogic/gdx/utils/Array.java:573–579  ·  view source on GitHub ↗

Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is taken.

(int newSize)

Source from the content-addressed store, hash-verified

571 /** Reduces the size of the array to the specified size. If the array is already smaller than the specified size, no action is
572 * taken. */
573 public void truncate (int newSize) {
574 if (newSize < 0) throw new IllegalArgumentException("newSize must be >= 0: " + newSize);
575 if (size <= newSize) return;
576 for (int i = newSize; i < size; i++)
577 items[i] = null;
578 size = newSize;
579 }
580
581 /** Returns a random item from the array, or null if the array is empty. */
582 public @Null T random () {

Callers 1

setSizeMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected