ConcurrentAppendOnlyChunkedList { public T get(int index) { if (index < 0) { return null; } long lastIndex = cachedLastIndex; if (index >= lastIndex) { lastIndex = getValidLastIndex(); if (index >= lastIndex) { return null; } CACHED_LAST_INDEX_UPDATER.lazySet(this, lastIndex); } final AtomicChunk<T> buffer; final int offset; if (index >= chunkSize) { offset = index & chunkMask; buffer = getChunkOf(index, lastIndex); } else { offset = index; buffer = firstBuffer; } return pollElement(buffer, offset); } ConcurrentAppendOnlyChunkedList(final int chunkSize); int size(); void addAll(T[] elements); T get(int index); void add(T e); T[] toArray(IntFunction<T[]> arrayAllocator);  }
@Test public void shouldGetReturnNullIfEmpty() { Assert.assertNull(chunkedList.get(0)); }