@Test public void testAdd() { ConcurrentOrderedSet<Integer> set = new ConcurrentOrderedSet<>(); Random r = new Random(); CountDownLatch latch = new CountDownLatch(1000); createStartAndJoinThreads(new Runnable() { @Override public void run() { latch.countDown(); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } while (!set.add(r.nextInt())){ } } }, 1000); assertEquals(1000, set.size); }
@Override public boolean add(T key) { lock.lockWrite(); boolean b = super.add(key); lock.unlockWrite(); return b; }
ConcurrentOrderedSet extends OrderedSet<T> implements ConcurrentCollection { @Override public boolean add(T key) { lock.lockWrite(); boolean b = super.add(key); lock.unlockWrite(); return b; } }
ConcurrentOrderedSet extends OrderedSet<T> implements ConcurrentCollection { @Override public boolean add(T key) { lock.lockWrite(); boolean b = super.add(key); lock.unlockWrite(); return b; } ConcurrentOrderedSet();  ConcurrentOrderedSet(int initialCapacity);  ConcurrentOrderedSet(int initialCapacity, float loadFactor);  ConcurrentOrderedSet(OrderedSet<? extends T> set); }
ConcurrentOrderedSet extends OrderedSet<T> implements ConcurrentCollection { @Override public boolean add(T key) { lock.lockWrite(); boolean b = super.add(key); lock.unlockWrite(); return b; } ConcurrentOrderedSet();  ConcurrentOrderedSet(int initialCapacity);  ConcurrentOrderedSet(int initialCapacity, float loadFactor);  ConcurrentOrderedSet(OrderedSet<? extends T> set); @Override boolean add(T key); @Override void addAll(Array<? extends T> array, int offset, int length); @Override void addAll(T[] array, int offset, int length); @Override void addAll(ObjectSet<T> set); @Override boolean remove(T key); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override void shrink(int maximumCapacity); @Override void clear(int maximumCapacity); @Override void clear(); @Override boolean contains(T key); @Override T get(T key); @Override T first(); @Override boolean add(T key, int index); @Override T removeIndex(int index); @Override Array<T> orderedItems(); @Override void ensureCapacity(int additionalCapacity); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override String toString(String separator); @Override OrderedSetIterator<T> iterator(); @Override ReadWriteLock getLock(); }
ConcurrentOrderedSet extends OrderedSet<T> implements ConcurrentCollection { @Override public boolean add(T key) { lock.lockWrite(); boolean b = super.add(key); lock.unlockWrite(); return b; } ConcurrentOrderedSet();  ConcurrentOrderedSet(int initialCapacity);  ConcurrentOrderedSet(int initialCapacity, float loadFactor);  ConcurrentOrderedSet(OrderedSet<? extends T> set); @Override boolean add(T key); @Override void addAll(Array<? extends T> array, int offset, int length); @Override void addAll(T[] array, int offset, int length); @Override void addAll(ObjectSet<T> set); @Override boolean remove(T key); @Override boolean notEmpty(); @Override boolean isEmpty(); @Override void shrink(int maximumCapacity); @Override void clear(int maximumCapacity); @Override void clear(); @Override boolean contains(T key); @Override T get(T key); @Override T first(); @Override boolean add(T key, int index); @Override T removeIndex(int index); @Override Array<T> orderedItems(); @Override void ensureCapacity(int additionalCapacity); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override String toString(String separator); @Override OrderedSetIterator<T> iterator(); @Override ReadWriteLock getLock();  }