@Test public void testAddItems() { ConcurrentLongArray a = new ConcurrentLongArray(); CountDownLatch latch = new CountDownLatch(10); createStartAndJoinThreads(new Runnable() { @Override public void run() { latch.countDown(); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } for (int i = 0; i < 1000; i++) { a.add(i); } } }, 10); assertEquals(a.size, 10*1000); }
@Override public void add(long value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); }
ConcurrentLongArray extends LongArray implements ConcurrentCollection { @Override public void add(long value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } }
ConcurrentLongArray extends LongArray implements ConcurrentCollection { @Override public void add(long value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentLongArray();  ConcurrentLongArray(int capacity);  ConcurrentLongArray(boolean ordered, int capacity);  ConcurrentLongArray(LongArray array);  ConcurrentLongArray(long[] array);  ConcurrentLongArray(boolean ordered, long[] array, int startIndex, int count); }
ConcurrentLongArray extends LongArray implements ConcurrentCollection { @Override public void add(long value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentLongArray();  ConcurrentLongArray(int capacity);  ConcurrentLongArray(boolean ordered, int capacity);  ConcurrentLongArray(LongArray array);  ConcurrentLongArray(long[] array);  ConcurrentLongArray(boolean ordered, long[] array, int startIndex, int count); @Override void add(long value); @Override void add(long value1, long value2); @Override void add(long value1, long value2, long value3); @Override void add(long value1, long value2, long value3, long value4); @Override void addAll(LongArray array, int offset, int length); @Override void addAll(long[] array, int offset, int length); @Override long get(int index); @Override void set(int index, long value); @Override void incr(int index, long value); @Override void mul(int index, long value); @Override void insert(int index, long value); @Override void swap(int first, int second); @Override boolean contains(long value); @Override int indexOf(long value); @Override int lastIndexOf(char value); @Override boolean removeValue(long value); @Override long removeIndex(int index); @Override void removeRange(int start, int end); @Override boolean removeAll(LongArray array); @Override long pop(); @Override long peek(); @Override long first(); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override void clear(); @Override long[] shrink(); @Override long[] ensureCapacity(int additionalCapacity); @Override long[] setSize(int newSize); @Override void sort(); @Override void reverse(); @Override void shuffle(); @Override void truncate(int newSize); @Override long random(); @Override long[] toArray(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); @Override String toString(String separator); @Override ReadWriteLock getLock(); }
ConcurrentLongArray extends LongArray implements ConcurrentCollection { @Override public void add(long value) { lock.lockWrite(); super.add(value); lock.unlockWrite(); } ConcurrentLongArray();  ConcurrentLongArray(int capacity);  ConcurrentLongArray(boolean ordered, int capacity);  ConcurrentLongArray(LongArray array);  ConcurrentLongArray(long[] array);  ConcurrentLongArray(boolean ordered, long[] array, int startIndex, int count); @Override void add(long value); @Override void add(long value1, long value2); @Override void add(long value1, long value2, long value3); @Override void add(long value1, long value2, long value3, long value4); @Override void addAll(LongArray array, int offset, int length); @Override void addAll(long[] array, int offset, int length); @Override long get(int index); @Override void set(int index, long value); @Override void incr(int index, long value); @Override void mul(int index, long value); @Override void insert(int index, long value); @Override void swap(int first, int second); @Override boolean contains(long value); @Override int indexOf(long value); @Override int lastIndexOf(char value); @Override boolean removeValue(long value); @Override long removeIndex(int index); @Override void removeRange(int start, int end); @Override boolean removeAll(LongArray array); @Override long pop(); @Override long peek(); @Override long first(); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override void clear(); @Override long[] shrink(); @Override long[] ensureCapacity(int additionalCapacity); @Override long[] setSize(int newSize); @Override void sort(); @Override void reverse(); @Override void shuffle(); @Override void truncate(int newSize); @Override long random(); @Override long[] toArray(); @Override int hashCode(); @Override boolean equals(Object object); @Override String toString(); @Override String toString(String separator); @Override ReadWriteLock getLock();  }