@Test public void remove() { Pair toRemove = mSet.getFirstByField(mUniqueLongIndex, 1L); assertEquals(1, mSet.getByField(mUniqueLongIndex, toRemove.longValue()).size()); assertEquals(9, mSet.size()); assertTrue(mSet.remove(toRemove)); assertEquals(8, mSet.size()); assertEquals(2, mSet.getByField(mNonUniqueIntIndex, toRemove.intValue()).size()); assertTrue("Element should be in the NonUniqueIntIndex", mSet.contains(mNonUniqueIntIndex, toRemove.intValue())); assertEquals(0, mSet.getByField(mUniqueLongIndex, toRemove.longValue()).size()); assertFalse("Element should not be in the mUniqueLongIndex", mSet.contains(mUniqueLongIndex, toRemove.longValue())); toRemove = mSet.getFirstByField(mNonUniqueIntIndex, 2); assertTrue(mSet.remove(toRemove)); assertTrue("Element should be in the NonUniqueIntIndex", mSet.contains(mNonUniqueIntIndex, toRemove.intValue())); toRemove = mSet.getFirstByField(mNonUniqueIntIndex, 2); assertTrue(mSet.remove(toRemove)); assertTrue("Element should be in the NonUniqueIntIndex", mSet.contains(mNonUniqueIntIndex, toRemove.intValue())); toRemove = mSet.getFirstByField(mNonUniqueIntIndex, 2); assertTrue(mSet.remove(toRemove)); assertFalse("Element should not be in the NonUniqueIntIndex", mSet.contains(mNonUniqueIntIndex, toRemove.intValue())); toRemove = mSet.getFirstByField(mNonUniqueIntIndex, 2); assertTrue(toRemove == null); }
@Override public boolean remove(Object object) { if (object == null) { return false; } synchronized (object) { if (mPrimaryIndex.containsObject((T) object)) { @SuppressWarnings("unchecked") T tObj = (T) object; removeFromIndices(tObj); return true; } else { return false; } } }
IndexedSet extends AbstractSet<T> { @Override public boolean remove(Object object) { if (object == null) { return false; } synchronized (object) { if (mPrimaryIndex.containsObject((T) object)) { @SuppressWarnings("unchecked") T tObj = (T) object; removeFromIndices(tObj); return true; } else { return false; } } } }
IndexedSet extends AbstractSet<T> { @Override public boolean remove(Object object) { if (object == null) { return false; } synchronized (object) { if (mPrimaryIndex.containsObject((T) object)) { @SuppressWarnings("unchecked") T tObj = (T) object; removeFromIndices(tObj); return true; } else { return false; } } } @SafeVarargs  IndexedSet(IndexDefinition<T, ?> primaryIndexDefinition,
      IndexDefinition<T, ?>... otherIndexDefinitions); }
IndexedSet extends AbstractSet<T> { @Override public boolean remove(Object object) { if (object == null) { return false; } synchronized (object) { if (mPrimaryIndex.containsObject((T) object)) { @SuppressWarnings("unchecked") T tObj = (T) object; removeFromIndices(tObj); return true; } else { return false; } } } @SafeVarargs  IndexedSet(IndexDefinition<T, ?> primaryIndexDefinition,
      IndexDefinition<T, ?>... otherIndexDefinitions); @Override void clear(); @Override boolean add(T object); @Override Iterator<T> iterator(); boolean contains(IndexDefinition<T, V> indexDefinition, V value); Set<T> getByField(IndexDefinition<T, V> indexDefinition, V value); T getFirstByField(IndexDefinition<T, V> indexDefinition, V value); @Override boolean remove(Object object); int removeByField(IndexDefinition<T, V> indexDefinition, V value); @Override int size(); }
IndexedSet extends AbstractSet<T> { @Override public boolean remove(Object object) { if (object == null) { return false; } synchronized (object) { if (mPrimaryIndex.containsObject((T) object)) { @SuppressWarnings("unchecked") T tObj = (T) object; removeFromIndices(tObj); return true; } else { return false; } } } @SafeVarargs  IndexedSet(IndexDefinition<T, ?> primaryIndexDefinition,
      IndexDefinition<T, ?>... otherIndexDefinitions); @Override void clear(); @Override boolean add(T object); @Override Iterator<T> iterator(); boolean contains(IndexDefinition<T, V> indexDefinition, V value); Set<T> getByField(IndexDefinition<T, V> indexDefinition, V value); T getFirstByField(IndexDefinition<T, V> indexDefinition, V value); @Override boolean remove(Object object); int removeByField(IndexDefinition<T, V> indexDefinition, V value); @Override int size();  }