Of course, I know about the performance difference between arraylist and linked list. I ran the tests myself and saw a huge difference in time and memory for insert / delete and iterate between arraylist and linked list for a very large list.
(Correct me if I am wrong) We usually prefer arraylist over a linked list, because:
1) We practically iterate more often than insert / delete. Therefore, we prefer iterations to be faster than insert / delete.
2) The overhead of a linked list's memory is much more than an arraylist
3) There is NO way that we can define a list as a linked list when inserting / deleting in batch mode and as an arraylist during iteration. This is due to the fact that arraylist and linked list have fundamentally different methods of data storage.
Am I wrong about the third paragraph [I hope so :)]? Is it possible to take advantage of these two data structures in one list? I think data structure developers should have thought about this.
source share