您的位置:首页 > 编程语言 > Java开发

Time complexity of ArrayList in Java

2015-03-27 11:50 274 查看
The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. All of the other operations run in linear time (roughly speaking). The constant factor is low compared to that for the LinkedList implementation.

Basically ArrayList is implemented by an Array.

Reference:

Official API

StackOverflow
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: