In C++, I would sometimes store objects in a linked list. I would associated the object with an iterator pointing to its location. Then, given the iterator, I could remove the object from the linked list in O(1) time. The operation is O(1), because the list just updates the pointers to the previous and next elements in the list. The C++ method I'm talking about: http://www.cplusplus.com/reference/list/list/erase/
Is there a way to do this with the same O(1) complexity in Java?
LinkedList seems to shift subsequent elements: https://docs.oracle.com/javase/7/docs/api/java/util/LinkedList.html#remove(int)
Maybe there is a different Java class to achieve this?
Thanks