@Test public void testRemove(){ ConcurrentObjectSet<Integer> set = new ConcurrentObjectSet<>(); for (int i = 0; i < 10000; i++) { set.add(i); } CountDownLatch latch = new CountDownLatch(1000); createStartAndJoinThreads(new Runnable() { @Override public void run() { latch.countDown(); try { latch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } for (int i = 0; i < 10; i++) { set.lock.lockWrite(); int key = set.first(); assertTrue(set.contains(key)); set.remove(key); assertFalse(set.contains(key)); set.lock.unlockWrite(); } } }, 1000); assertEquals(0, set.size); }
@Override public boolean remove(T key) { lock.lockWrite(); boolean b = super.remove(key); lock.unlockWrite(); return b; }
ConcurrentObjectSet extends ObjectSet<T> implements ConcurrentCollection { @Override public boolean remove(T key) { lock.lockWrite(); boolean b = super.remove(key); lock.unlockWrite(); return b; } }
ConcurrentObjectSet extends ObjectSet<T> implements ConcurrentCollection { @Override public boolean remove(T key) { lock.lockWrite(); boolean b = super.remove(key); lock.unlockWrite(); return b; } ConcurrentObjectSet();  ConcurrentObjectSet(int initialCapacity);  ConcurrentObjectSet(int initialCapacity, float loadFactor);  ConcurrentObjectSet(ObjectSet<? extends T> set); }
ConcurrentObjectSet extends ObjectSet<T> implements ConcurrentCollection { @Override public boolean remove(T key) { lock.lockWrite(); boolean b = super.remove(key); lock.unlockWrite(); return b; } ConcurrentObjectSet();  ConcurrentObjectSet(int initialCapacity);  ConcurrentObjectSet(int initialCapacity, float loadFactor);  ConcurrentObjectSet(ObjectSet<? 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 void ensureCapacity(int additionalCapacity); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override String toString(String separator); @Override ObjectSetIterator<T> iterator(); @Override ReadWriteLock getLock(); }
ConcurrentObjectSet extends ObjectSet<T> implements ConcurrentCollection { @Override public boolean remove(T key) { lock.lockWrite(); boolean b = super.remove(key); lock.unlockWrite(); return b; } ConcurrentObjectSet();  ConcurrentObjectSet(int initialCapacity);  ConcurrentObjectSet(int initialCapacity, float loadFactor);  ConcurrentObjectSet(ObjectSet<? 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 void ensureCapacity(int additionalCapacity); @Override int hashCode(); @Override boolean equals(Object obj); @Override String toString(); @Override String toString(String separator); @Override ObjectSetIterator<T> iterator(); @Override ReadWriteLock getLock();  }