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