why LinkedList doesn't have initialCapacity in java?

前端 未结 6 1178
不知归路
不知归路 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:51

    Linkedlist does not need an initial value. Thats is the primary difference between array and linked list.

    array will end somewhere. But linkedlist not. Linked list does not work on boundary values.

提交回复
热议问题