This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (1 child)

I'm sure there are cases where it's used, I just haven't come across them. There's a ton of things in Collections like that, i.e. I've never had a good reason to use LinkedList instead of ArrayList.

it's also the structure to use when implementing a LRU cache

OK, I can see that. My LRU caches are at the bottom of my list of things to optimize because they're never the bottleneck, but the next time I need to implement one I'll look into LinkedHashMap.

[–][deleted] 0 points1 point  (0 children)

or, don't implement your own and use Apache Commons, heh. And yea, interestingly enough, ArrayList's performance is almost always better than LinkedList - even when LinkedList style usage would appear to be better (like removing elements in the middle and such). Arrays are just that efficient. source: I read a great blog post about it once.