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