Tabnine Logo
RecyclingArrayList.rangeCheck
Code IndexAdd Tabnine to your IDE (free)

How to use
rangeCheck
method
in
us.ihmc.robotics.lists.RecyclingArrayList

Best Java code snippets using us.ihmc.robotics.lists.RecyclingArrayList.rangeCheck (Showing top 4 results out of 315)

origin: us.ihmc/IHMCRoboticsToolkit

/**
* Removes the element at the specified position in this list.
* Shifts any subsequent elements to the left (subtracts one from their
* indices).
*
* @param index the index of the element to be removed
* @return null.
*/
@Override
public T remove(int i)
{
 if (i == size - 1)
 {
   size--;
   return null;
 }
 rangeCheck(i);
 T t = elementData[i];
 while (i < size - 1)
 {
   elementData[i] = elementData[++i];
 }
 // Do not throw away the removed element, put it at the end of the list instead.
 elementData[size - 1] = t;
 size--;
 return null;
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Swap two objects of this list.
* @param i index of the first object to swap
* @param j index of the second object to swap
* @throws IndexOutOfBoundsException if either of the indices is out of range
*         (<tt>i &lt; 0 || i &gt;= size() || j &lt; 0 || j &gt;= size()</tt>)
*/
public void swap(int i, int j)
{
 rangeCheck(i);
 rangeCheck(j);
 unsafeSwap(i, j);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Returns the element at the specified position in this list.
*
* @param  index index of the element to return
* @return the element at the specified position in this list
* @throws IndexOutOfBoundsException if the index is out of range
 *         (<tt>index &lt; 0 || index &gt;= size()</tt>)
*/
@Override
public T get(int i)
{
 rangeCheck(i);
 return unsafeGet(i);
}
origin: us.ihmc/IHMCRoboticsToolkit

/**
* Removes the element at the specified position in this list.
* This method is faster than {@link RecyclingArrayList#remove(int)} but the ith element is swapped with the last element changing the ordering of the list.
*
* @param index the index of the element to be removed
*/
public void fastRemove(int index)
{
 if (index == size - 1)
 {
   size--;
   return;
 }
 rangeCheck(index);
 unsafeFastSwap(index, --size);
}
us.ihmc.robotics.listsRecyclingArrayListrangeCheck

Javadoc

Checks if the given index is in range. If not, throws an appropriate runtime exception. This method does *not* check if the index is negative: It is always used immediately prior to an array access, which throws an ArrayIndexOutOfBoundsException if index is negative.

Popular methods of RecyclingArrayList

  • get
    Returns the element at the specified position in this list.
  • add
    Unsupported operation.
  • clear
    Sets the size of the list to 0, but does not change its capacity. This method is meant to recycle a
  • size
    Returns the number of elements in this list.
  • <init>
  • isEmpty
    Returns true if this list contains no elements.
  • getAndGrowIfNeeded
    Returns the element at the specified position in this list. The list will grow if the given index is
  • getLast
    Returns the last element of this list. If the list is empty, it returns null.
  • remove
    Removes the first occurrence of the specified element from this list, if it is present. If the list
  • checkWithMaxCapacity
  • ensureCapacity
  • fillElementDataIfNeeded
  • ensureCapacity,
  • fillElementDataIfNeeded,
  • indexOf,
  • positiveIndexCheck,
  • rangeCheckForInsert,
  • toArray,
  • unsafeFastSwap,
  • unsafeGet,
  • unsafeGrowByN

Popular in Java

  • Reactive rest calls using spring rest template
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • JFileChooser (javax.swing)
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Github Copilot alternatives
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