I need a data structure with the following requirements:
- You need to be able to get items by index (for example, List).
- I will always add / remove elements from the end of the structure.
I tend to use an ArrayList . In this situation, it seems that O(1) how to read elements (are they always there?), Delete elements (I only need to delete them at the end of the list), and add (I add only to the end of the list).
The only problem is that from time to time the ArrayList will have a performance penalty when it is completely full, and I need to add a few more elements to it.
Is there any other idea? I do not think of a data structure that would break an ArrayList here.
thanks
source share