I want to have a list of objects that satisfies just a few basic requirements. It needs to support fast random access and it needs to be safe to use from multiple threads. Reads will dominate by far and ideally should be about as fast as normal ArrayList
access, i.e. no locking. There is no need to insert elements in the middle, delete, or change the value at an index: the only mutation required is to be able to append a new element to the end of the list. More specifically a caller will specify an index at which an element should be placed, and the index is expected to be only a few more than the length of the list, i.e. the list is dense. There is also no need for iteration.
Is there anything that supports this in Java? It can be in a third party library.
If not I am thinking I will implement my own class. There'll be an internal array of arrays, each twice as big as the last. Lookups by index will do just a little more maths to figure out which array has the right element and what the index in that array is. Appends will be similar unless they go beyond the available space, in which case a new array is allocated. Only the creation of a new array will require a lock to be acquired.
Does this sound like a sensible approach?
This doesn't sound like a particularly novel data structure. Does it have a name?