Java中Map和ArrayList根据下标的查询效率相比怎样

【Java中Map和ArrayList根据下标的查询效率相比怎样】 map是按key进行查找的,list是按index进行查找的。
map好像没有按照index进行查找的api?

■网友
map会有conflict的问题 在最差情况下会退化成list 虽然在jdk8中对于这个list的搜索已经从O(n)优化到了O(logn) 但是和arraylist基于下标的O(1)复杂度对比总归略逊一筹

■网友
map的话hashmap是O(1)treemap是O(logn)arraylist的话是O(n)了


    推荐阅读