why LinkedList doesn't have initialCapacity in java?

前端 未结 6 1012
不知归路
不知归路 2021-02-07 00:54

I wonder why LinkedList doesn\'t have initialCapacity.

I know good when to use ArrayList and when LinkedList.

6条回答
  •  余生分开走
    2021-02-07 01:41

    Why would LinkedList have an initial capacity?

    ArrayList is backed up by an array, so the initial capacity is the initial size of the array. LinkedList has no need of that.

提交回复
热议问题