java.util.ArrayList.outOfBoundsMsg()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(213)

本文整理了Java中java.util.ArrayList.outOfBoundsMsg()方法的一些代码示例,展示了ArrayList.outOfBoundsMsg()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ArrayList.outOfBoundsMsg()方法的具体详情如下:
包路径:java.util.ArrayList
类名称:ArrayList
方法名:outOfBoundsMsg

ArrayList.outOfBoundsMsg介绍

[英]Constructs an IndexOutOfBoundsException detail message. Of the many possible refactorings of the error handling code, this "outlining" performs best with both server and client VMs.
[中]构造IndexOutOfBoundsException详细信息消息。在许多可能的错误处理代码重构中,这种“大纲”在服务器和客户端虚拟机上都表现得最好。

代码示例

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * 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.
 */
private void rangeCheck(int index) {
  if (index >= size)
    throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

代码示例来源:origin: org.apidesign.bck2brwsr/emul

/**
 * A version of rangeCheck used by add and addAll.
 */
private void rangeCheckForAdd(int index) {
  if (index > size || index < 0)
    throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * 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.
 */
private void rangeCheck(int index) {
  if (index >= size)
    throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

代码示例来源:origin: jtulach/bck2brwsr

/**
 * A version of rangeCheck used by add and addAll.
 */
private void rangeCheckForAdd(int index) {
  if (index > size || index < 0)
    throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

代码示例来源:origin: dragome/dragome-sdk

private void rangeCheckForAdd(int index)
{
  if (index > size() || index < 0)
    throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

代码示例来源:origin: com.jtransc/jtransc-rt

@JTranscSync
private void rangeCheckForAdd(int index) {
  if (index > size() || index < 0) throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

代码示例来源:origin: com.jtransc/jtransc-rt

@JTranscSync
private void rangeCheck(int index) {
  if (index >= size()) throw new IndexOutOfBoundsException(outOfBoundsMsg(index));
}

相关文章