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