Over the past few years I’ve had to delve deeper into Spring’s source. I’ve noticed that the developers really like linked lists.I’m not sure why they chose this as their list implementation over array list. Does anyone know why the made this deferment decision?
Share
It really depends on the usage. But perhaps it is because the space complexity when growing a Linked Lists is cheap, and if you are just iterating over a collection you don’t do any find operations it is a good choice. Recall ArrayList implementation has a geometric growth model and is a bad choice if you don’t know apriori how large the list will be. Growing the list past the current capacity will cause the current array to get copied to a new array of twice the current capacity.