3 ms·
I run into people that use LinkedList everywhere in their code "for efficiency". It always confuses me. Are CS professors teaching something that leads to this?
by _ea1k 4y ago
I run into people that use LinkedList everywhere in their code "for efficiency". It always confuses me. Are CS professors teaching something that leads to this?
In practice, it seems unusual for it to have any advantages over just using an ArrayList in typical JVM applications.
- taeric 4y agoI blame an over reliance on Big O as an arbiter of what is a fast algorithm. Linked lists are commonly taught as having much better insertion speed than arrays. This ignores constant factors and cache coherency, of course. More, it also ignores that most lists that folks will make have a VERY predictable access pattern. Typically just a one way scan, if any traversal at all. With very few inserts, and mostly just appending.
- Narishma 4y agoCache locality, not coherency.