congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
ShortArray.resize
Code IndexAdd Tabnine to your IDE (free)

How to use
resize
method
in
com.badlogic.gdx.utils.ShortArray

Best Java code snippets using com.badlogic.gdx.utils.ShortArray.resize (Showing top 20 results out of 315)

origin: libgdx/libgdx

/** 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.
 * @return {@link #items} */
public short[] shrink () {
  if (items.length != size) resize(size);
  return items;
}
origin: libgdx/libgdx

/** 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.
 * @return {@link #items} */
public short[] shrink () {
  if (items.length != size) resize(size);
  return items;
}
origin: libgdx/libgdx

public void add (short value1, short value2, short value3, short value4) {
  short[] items = this.items;
  if (size + 3 >= items.length) items = resize(Math.max(8, (int)(size * 1.8f))); // 1.75 isn't enough when size=5.
  items[size] = value1;
  items[size + 1] = value2;
  items[size + 2] = value3;
  items[size + 3] = value4;
  size += 4;
}
origin: libgdx/libgdx

public void add (short value1, short value2) {
  short[] items = this.items;
  if (size + 1 >= items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size] = value1;
  items[size + 1] = value2;
  size += 2;
}
origin: libgdx/libgdx

public void add (short value1, short value2) {
  short[] items = this.items;
  if (size + 1 >= items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size] = value1;
  items[size + 1] = value2;
  size += 2;
}
origin: libgdx/libgdx

/** Casts the specified value to short and adds it. */
public void add (int value) {
  short[] items = this.items;
  if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size++] = (short)value;
}
origin: libgdx/libgdx

public void add (short value1, short value2, short value3) {
  short[] items = this.items;
  if (size + 2 >= items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size] = value1;
  items[size + 1] = value2;
  items[size + 2] = value3;
  size += 3;
}
origin: libgdx/libgdx

/** Casts the specified value to short and adds it. */
public void add (int value) {
  short[] items = this.items;
  if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size++] = (short)value;
}
origin: libgdx/libgdx

public void add (short value) {
  short[] items = this.items;
  if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size++] = value;
}
origin: libgdx/libgdx

public void add (short value1, short value2, short value3) {
  short[] items = this.items;
  if (size + 2 >= items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size] = value1;
  items[size + 1] = value2;
  items[size + 2] = value3;
  size += 3;
}
origin: libgdx/libgdx

public void add (short value1, short value2, short value3, short value4) {
  short[] items = this.items;
  if (size + 3 >= items.length) items = resize(Math.max(8, (int)(size * 1.8f))); // 1.75 isn't enough when size=5.
  items[size] = value1;
  items[size + 1] = value2;
  items[size + 2] = value3;
  items[size + 3] = value4;
  size += 4;
}
origin: libgdx/libgdx

public void add (short value) {
  short[] items = this.items;
  if (size == items.length) items = resize(Math.max(8, (int)(size * 1.75f)));
  items[size++] = value;
}
origin: libgdx/libgdx

public void addAll (short[] array, int offset, int length) {
  short[] items = this.items;
  int sizeNeeded = size + length;
  if (sizeNeeded > items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f)));
  System.arraycopy(array, offset, items, size, length);
  size += length;
}
origin: libgdx/libgdx

/** Increases the size of the backing array to accommodate the specified number of additional items. Useful before adding many
 * items to avoid multiple backing array resizes.
 * @return {@link #items} */
public short[] ensureCapacity (int additionalCapacity) {
  if (additionalCapacity < 0) throw new IllegalArgumentException("additionalCapacity must be >= 0: " + additionalCapacity);
  int sizeNeeded = size + additionalCapacity;
  if (sizeNeeded > items.length) resize(Math.max(8, sizeNeeded));
  return items;
}
origin: libgdx/libgdx

/** Sets the array size, leaving any values beyond the current size undefined.
 * @return {@link #items} */
public short[] setSize (int newSize) {
  if (newSize < 0) throw new IllegalArgumentException("newSize must be >= 0: " + newSize);
  if (newSize > items.length) resize(Math.max(8, newSize));
  size = newSize;
  return items;
}
origin: libgdx/libgdx

/** Sets the array size, leaving any values beyond the current size undefined.
 * @return {@link #items} */
public short[] setSize (int newSize) {
  if (newSize < 0) throw new IllegalArgumentException("newSize must be >= 0: " + newSize);
  if (newSize > items.length) resize(Math.max(8, newSize));
  size = newSize;
  return items;
}
origin: libgdx/libgdx

/** Increases the size of the backing array to accommodate the specified number of additional items. Useful before adding many
 * items to avoid multiple backing array resizes.
 * @return {@link #items} */
public short[] ensureCapacity (int additionalCapacity) {
  if (additionalCapacity < 0) throw new IllegalArgumentException("additionalCapacity must be >= 0: " + additionalCapacity);
  int sizeNeeded = size + additionalCapacity;
  if (sizeNeeded > items.length) resize(Math.max(8, sizeNeeded));
  return items;
}
origin: libgdx/libgdx

public void addAll (short[] array, int offset, int length) {
  short[] items = this.items;
  int sizeNeeded = size + length;
  if (sizeNeeded > items.length) items = resize(Math.max(8, (int)(sizeNeeded * 1.75f)));
  System.arraycopy(array, offset, items, size, length);
  size += length;
}
origin: libgdx/libgdx

public void insert (int index, short value) {
  if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size);
  short[] 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;
}
origin: libgdx/libgdx

public void insert (int index, short value) {
  if (index > size) throw new IndexOutOfBoundsException("index can't be > size: " + index + " > " + size);
  short[] 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;
}
com.badlogic.gdx.utilsShortArrayresize

Popular methods of ShortArray

  • get
  • <init>
    Creates a new ordered array containing the elements in the specified array. The capacity is set to t
  • add
  • clear
  • ensureCapacity
    Increases the size of the backing array to accommodate the specified number of additional items. Use
  • set
  • addAll
  • removeIndex
    Removes and returns the item at the specified index.
  • toArray
  • pop
    Removes and returns the last item.

Popular in Java

  • Updating database using SQL prepared statement
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onCreateOptionsMenu (Activity)
  • getSupportFragmentManager (FragmentActivity)
  • URLEncoder (java.net)
    This class is used to encode a string using the format required by application/x-www-form-urlencoded
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • Permission (java.security)
    Legacy security code; do not use.
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now