小编aas*_*asu的帖子

为什么java.util.ArrayList中有私有方法outOfBoundsMsg?

这里的片段来自java.util.ArrayList:

/**
 * 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.
 */
private String outOfBoundsMsg(int index) {
    return "Index: "+index+", Size: "+size;
}
Run Code Online (Sandbox Code Playgroud)

这里的片段来自com.google.collect.Preconditions:

  /*
   * All recent hotspots (as of 2009) *really* like to have the natural code
   *
   * if (guardExpression) {
   *    throw new BadException(messageExpression);
   * }
   *
   * refactored so that messageExpression is …
Run Code Online (Sandbox Code Playgroud)

java exception-handling arraylist jvm-hotspot guava

6
推荐指数
1
解决办法
242
查看次数

标签 统计

arraylist ×1

exception-handling ×1

guava ×1

java ×1

jvm-hotspot ×1