3 ms·
Thing is that in a pointer heavy environment like Java (or Python, JS, C#, even C++ with too much OOP), it does not matter that much. The ArrayList will be a n
by exyi 4y ago
Thing is that in a pointer heavy environment like Java (or Python, JS, C#, even C++ with too much OOP), it does not matter that much.
The ArrayList will be a nice flat chunk of memory... of pointers to the data, so you'll have to do a lookup for each element anyway. The LinkedList will have two lookups still, but it's not an order of magnitude anymore. Now it's more of a tradeoff between bit slower reads / bit faster updates.