JDK1.8ArrayList源码分析2

E get(int index) 因为ArrayList是采用数组结构来存储的,所以它的get方法非常简单,先是判断一下有没有越界,之后就可以直接通过数组下标来获取元素了,所以get的时间复杂度是O(1)。 /** * Returns the element at the specified position in this list. * 返回列表中指定位置的元素。
相关文章
相关标签/搜索