Why spring source code uses linked list so much

Over the past few years, I have had to delve into the source of Spring. I noticed that developers really like linked lists. I am not sure why they chose this as an implementation of a list by a list of arrays. Does anyone know why this decision was made to be deferred?

+3
source share
1 answer

It really depends on the use. But perhaps this is due to the fact that the complexity of the space when growing linked lists is cheap, and if you just iterate through the collection, you do not perform any search operations, this is a good choice. Recall that the ArrayList implementation has a geometric growth model and is a poor choice if you don't know how big the list will be. Increasing the list for the current capacity will cause the current array to be copied to the new array twice as much as the current capacity.

+2
source

All Articles