My data structures course says a linked list has O(1) insertion and removal while an array list is O(n), so I used LinkedList for a buffer of about 100,000 measurement objects where I insert and remove in the middle. A quick benchmark shows ArrayList is faster for almost every operation I try, including the middle inserts.
Is the textbook complexity wrong, or is my benchmark? When is LinkedList actually the right choice, and what should I use for a FIFO queue of samples?




