@Test public void testAddItems() { ConcurrentDelayedRemovalArray<Integer> a = new ConcurrentDelayedRemovalArray<>(); CountDownLatch latch = new CountDownLatch(100); createStartAndJoinThreads(new Runnable() { @Override public void run() { latch.countDown(); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } for (int i = 0; i < 100; i++) { a.add(i); } } }, 100); assertEquals(a.size, 10*1000); }
@Override public void add(T value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); }
ConcurrentDelayedRemovalArray extends DelayedRemovalArray<T> implements ConcurrentCollection { @Override public void add(T value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } }
ConcurrentDelayedRemovalArray extends DelayedRemovalArray<T> implements ConcurrentCollection { @Override public void add(T value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentDelayedRemovalArray();  ConcurrentDelayedRemovalArray(Array<? extends T> array);  ConcurrentDelayedRemovalArray(boolean ordered, int capacity, Class arrayType);  ConcurrentDelayedRemovalArray(boolean ordered, int capacity);  ConcurrentDelayedRemovalArray(boolean ordered, T[] array, int startIndex, int count);  ConcurrentDelayedRemovalArray(Class arrayType);  ConcurrentDelayedRemovalArray(int capacity);  ConcurrentDelayedRemovalArray(T[] array); }
ConcurrentDelayedRemovalArray extends DelayedRemovalArray<T> implements ConcurrentCollection { @Override public void add(T value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentDelayedRemovalArray();  ConcurrentDelayedRemovalArray(Array<? extends T> array);  ConcurrentDelayedRemovalArray(boolean ordered, int capacity, Class arrayType);  ConcurrentDelayedRemovalArray(boolean ordered, int capacity);  ConcurrentDelayedRemovalArray(boolean ordered, T[] array, int startIndex, int count);  ConcurrentDelayedRemovalArray(Class arrayType);  ConcurrentDelayedRemovalArray(int capacity);  ConcurrentDelayedRemovalArray(T[] array); @Override void begin(); @Override void end(); @Override boolean removeValue(T value, boolean identity); @Override T removeIndex(int index); @Override void removeRange(int start, int end); @Override void clear(); @Override void set(int index, T value); @Override void insert(int index, T value); @Override void swap(int first, int second); @Override T pop(); @Override void sort(); @Override void sort(Comparator<? super T> comparator); @Override void reverse(); @Override void shuffle(); @Override void truncate(int newSize); @Override T[] setSize(int newSize); @Override void add(T value); @Override void add(T value1, T value2); @Override void add(T value1, T value2, T value3); @Override void add(T value1, T value2, T value3, T value4); @Override void addAll(Array<? extends T> array, int start, int count); @Override void addAll(T[] array, int start, int count); @Override T get(int index); @Override boolean contains(T value, boolean identity); @Override boolean containsAll(Array<? extends T> values, boolean identity); @Override boolean containsAny(Array<? extends T> values, boolean identity); @Override int indexOf(T value, boolean identity); @Override int lastIndexOf(T value, boolean identity); @Override boolean removeAll(Array<? extends T> array, boolean identity); @Override T peek(); @Override T first(); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override T[] shrink(); @Override T[] ensureCapacity(int additionalCapacity); @Override T selectRanked(Comparator<T> comparator, int kthLowest); @Override int selectRankedIndex(Comparator<T> comparator, int kthLowest); @Override Iterator<T> iterator(); @Override Iterable<T> select(Predicate<T> predicate); @Override T random(); @Override T[] toArray(); @Override V[] toArray(Class<V> type); @Override int hashCode(); @Override boolean equals(Object object); @Override boolean equalsIdentity(Object object); @Override String toString(); @Override String toString(String separator); @Override ReadWriteLock getLock(); }
ConcurrentDelayedRemovalArray extends DelayedRemovalArray<T> implements ConcurrentCollection { @Override public void add(T value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentDelayedRemovalArray();  ConcurrentDelayedRemovalArray(Array<? extends T> array);  ConcurrentDelayedRemovalArray(boolean ordered, int capacity, Class arrayType);  ConcurrentDelayedRemovalArray(boolean ordered, int capacity);  ConcurrentDelayedRemovalArray(boolean ordered, T[] array, int startIndex, int count);  ConcurrentDelayedRemovalArray(Class arrayType);  ConcurrentDelayedRemovalArray(int capacity);  ConcurrentDelayedRemovalArray(T[] array); @Override void begin(); @Override void end(); @Override boolean removeValue(T value, boolean identity); @Override T removeIndex(int index); @Override void removeRange(int start, int end); @Override void clear(); @Override void set(int index, T value); @Override void insert(int index, T value); @Override void swap(int first, int second); @Override T pop(); @Override void sort(); @Override void sort(Comparator<? super T> comparator); @Override void reverse(); @Override void shuffle(); @Override void truncate(int newSize); @Override T[] setSize(int newSize); @Override void add(T value); @Override void add(T value1, T value2); @Override void add(T value1, T value2, T value3); @Override void add(T value1, T value2, T value3, T value4); @Override void addAll(Array<? extends T> array, int start, int count); @Override void addAll(T[] array, int start, int count); @Override T get(int index); @Override boolean contains(T value, boolean identity); @Override boolean containsAll(Array<? extends T> values, boolean identity); @Override boolean containsAny(Array<? extends T> values, boolean identity); @Override int indexOf(T value, boolean identity); @Override int lastIndexOf(T value, boolean identity); @Override boolean removeAll(Array<? extends T> array, boolean identity); @Override T peek(); @Override T first(); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override T[] shrink(); @Override T[] ensureCapacity(int additionalCapacity); @Override T selectRanked(Comparator<T> comparator, int kthLowest); @Override int selectRankedIndex(Comparator<T> comparator, int kthLowest); @Override Iterator<T> iterator(); @Override Iterable<T> select(Predicate<T> predicate); @Override T random(); @Override T[] toArray(); @Override V[] toArray(Class<V> type); @Override int hashCode(); @Override boolean equals(Object object); @Override boolean equalsIdentity(Object object); @Override String toString(); @Override String toString(String separator); @Override ReadWriteLock getLock();  }