Tabnine Logo
ArrayList.throwIndexOutOfBoundsException
Code IndexAdd Tabnine to your IDE (free)

How to use
throwIndexOutOfBoundsException
method
in
java.util.ArrayList

Best Java code snippets using java.util.ArrayList.throwIndexOutOfBoundsException (Showing top 20 results out of 315)

origin: robovm/robovm

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: robovm/robovm

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: robovm/robovm

/**
 * Replaces the element at the specified location in this {@code ArrayList}
 * with the specified object.
 *
 * @param index
 *            the index at which to put the specified object.
 * @param object
 *            the object to add.
 * @return the previous element at the index.
 * @throws IndexOutOfBoundsException
 *             when {@code location < 0 || location >= size()}
 */
@Override public E set(int index, E object) {
  Object[] a = array;
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  @SuppressWarnings("unchecked") E result = (E) a[index];
  a[index] = object;
  return result;
}
origin: robovm/robovm

/**
 * Removes the object at the specified location from this list.
 *
 * @param index
 *            the index of the object to remove.
 * @return the removed object.
 * @throws IndexOutOfBoundsException
 *             when {@code location < 0 || location >= size()}
 */
@Override public E remove(int index) {
  Object[] a = array;
  int s = size;
  if (index >= s) {
    throwIndexOutOfBoundsException(index, s);
  }
  @SuppressWarnings("unchecked") E result = (E) a[index];
  System.arraycopy(a, index + 1, a, index, --s - index);
  a[s] = null;  // Prevent memory leak
  size = s;
  modCount++;
  return result;
}
origin: robovm/robovm

int s = size;
if (index > s || index < 0) {
  throwIndexOutOfBoundsException(index, s);
origin: robovm/robovm

int s = size;
if (index > s || index < 0) {
  throwIndexOutOfBoundsException(index, s);
origin: ibinti/bugvm

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: com.gluonhq/robovm-rt

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: ibinti/bugvm

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: MobiVM/robovm

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: MobiVM/robovm

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: com.mobidevelop.robovm/robovm-rt

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: com.bugvm/bugvm-rt

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: com.bugvm/bugvm-rt

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: com.gluonhq/robovm-rt

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: com.mobidevelop.robovm/robovm-rt

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: FlexoVM/flexovm

@Override
public E get(int location) {
  try {
    return a[location];
  } catch (ArrayIndexOutOfBoundsException e) {
    throw java.util.ArrayList.throwIndexOutOfBoundsException(location, a.length);
  }
}
origin: FlexoVM/flexovm

@SuppressWarnings("unchecked") @Override public E get(int index) {
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  return (E) array[index];
}
origin: com.bugvm/bugvm-rt

/**
 * Replaces the element at the specified location in this {@code ArrayList}
 * with the specified object.
 *
 * @param index
 *            the index at which to put the specified object.
 * @param object
 *            the object to add.
 * @return the previous element at the index.
 * @throws IndexOutOfBoundsException
 *             when {@code location < 0 || location >= size()}
 */
@Override public E set(int index, E object) {
  Object[] a = array;
  if (index >= size) {
    throwIndexOutOfBoundsException(index, size);
  }
  @SuppressWarnings("unchecked") E result = (E) a[index];
  a[index] = object;
  return result;
}
origin: MobiVM/robovm

/**
 * Removes the object at the specified location from this list.
 *
 * @param index
 *            the index of the object to remove.
 * @return the removed object.
 * @throws IndexOutOfBoundsException
 *             when {@code location < 0 || location >= size()}
 */
@Override public E remove(int index) {
  Object[] a = array;
  int s = size;
  if (index >= s) {
    throwIndexOutOfBoundsException(index, s);
  }
  @SuppressWarnings("unchecked") E result = (E) a[index];
  System.arraycopy(a, index + 1, a, index, --s - index);
  a[s] = null;  // Prevent memory leak
  size = s;
  modCount++;
  return result;
}
java.utilArrayListthrowIndexOutOfBoundsException

Javadoc

This method was extracted to encourage VM to inline callers. TODO: when we have a VM that can actually inline, move the test in here too!

Popular methods of ArrayList

  • <init>
  • add
  • size
    Returns the number of elements in this ArrayList.
  • get
    Returns the element at the specified position in this list.
  • toArray
    Returns an array containing all of the elements in this list in proper sequence (from first to last
  • addAll
    Adds the objects in the specified collection to this ArrayList.
  • remove
    Removes the first occurrence of the specified element from this list, if it is present. If the list
  • clear
    Removes all elements from this ArrayList, leaving it empty.
  • isEmpty
    Returns true if this list contains no elements.
  • iterator
    Returns an iterator over the elements in this list in proper sequence.The returned iterator is fail-
  • contains
    Searches this ArrayList for the specified object.
  • set
    Replaces the element at the specified position in this list with the specified element.
  • contains,
  • set,
  • indexOf,
  • clone,
  • subList,
  • stream,
  • ensureCapacity,
  • trimToSize,
  • removeAll,
  • toString

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getExternalFilesDir (Context)
  • BorderLayout (java.awt)
    A border layout lays out a container, arranging and resizing its components to fit in five regions:
  • GridLayout (java.awt)
    The GridLayout class is a layout manager that lays out a container's components in a rectangular gri
  • Proxy (java.net)
    This class represents proxy server settings. A created instance of Proxy stores a type and an addres
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • 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