@Test public void testAddItems() { ConcurrentIntArray a = new ConcurrentIntArray(); 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(int value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); }
ConcurrentIntArray extends IntArray implements ConcurrentCollection { @Override public void add(int value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } }
ConcurrentIntArray extends IntArray implements ConcurrentCollection { @Override public void add(int value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentIntArray();  ConcurrentIntArray(int capacity);  ConcurrentIntArray(boolean ordered, int capacity);  ConcurrentIntArray(IntArray array);  ConcurrentIntArray(int[] array);  ConcurrentIntArray(boolean ordered, int[] array, int startIndex, int count); }
ConcurrentIntArray extends IntArray implements ConcurrentCollection { @Override public void add(int value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentIntArray();  ConcurrentIntArray(int capacity);  ConcurrentIntArray(boolean ordered, int capacity);  ConcurrentIntArray(IntArray array);  ConcurrentIntArray(int[] array);  ConcurrentIntArray(boolean ordered, int[] array, int startIndex, int count); @Override void add(int value); @Override void add(int value1, int value2); @Override void add(int value1, int value2, int value3); @Override void add(int value1, int value2, int value3, int value4); @Override void addAll(IntArray array, int offset, int length); @Override void addAll(int[] array, int offset, int length); @Override int get(int index); @Override void set(int index, int value); @Override void incr(int index, int value); @Override void mul(int index, int value); @Override void insert(int index, int value); @Override void swap(int first, int second); @Override boolean contains(int value); @Override int indexOf(int value); @Override int lastIndexOf(int value); @Override boolean removeValue(int value); @Override int removeIndex(int index); @Override void removeRange(int start, int end); @Override boolean removeAll(IntArray array); @Override int pop(); @Override int peek(); @Override int first(); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override void clear(); @Override int[] shrink(); @Override int[] ensureCapacity(int additionalCapacity); @Override int[] setSize(int newSize); @Override void sort(); @Override void reverse(); @Override void shuffle(); @Override void truncate(int newSize); @Override int random(); @Override int[] toArray(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); @Override String toString(String separator); @Override ReadWriteLock getLock(); }
ConcurrentIntArray extends IntArray implements ConcurrentCollection { @Override public void add(int value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentIntArray();  ConcurrentIntArray(int capacity);  ConcurrentIntArray(boolean ordered, int capacity);  ConcurrentIntArray(IntArray array);  ConcurrentIntArray(int[] array);  ConcurrentIntArray(boolean ordered, int[] array, int startIndex, int count); @Override void add(int value); @Override void add(int value1, int value2); @Override void add(int value1, int value2, int value3); @Override void add(int value1, int value2, int value3, int value4); @Override void addAll(IntArray array, int offset, int length); @Override void addAll(int[] array, int offset, int length); @Override int get(int index); @Override void set(int index, int value); @Override void incr(int index, int value); @Override void mul(int index, int value); @Override void insert(int index, int value); @Override void swap(int first, int second); @Override boolean contains(int value); @Override int indexOf(int value); @Override int lastIndexOf(int value); @Override boolean removeValue(int value); @Override int removeIndex(int index); @Override void removeRange(int start, int end); @Override boolean removeAll(IntArray array); @Override int pop(); @Override int peek(); @Override int first(); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override void clear(); @Override int[] shrink(); @Override int[] ensureCapacity(int additionalCapacity); @Override int[] setSize(int newSize); @Override void sort(); @Override void reverse(); @Override void shuffle(); @Override void truncate(int newSize); @Override int random(); @Override int[] toArray(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); @Override String toString(String separator); @Override ReadWriteLock getLock();  }