LocalUniqueIndex extends LocalMapIndex<T, T> { @Override public void remove( String nodeKey, String propertyName, T value ) { for (T key : Fun.filter(valuesByKey, nodeKey)) { if (comparator.compare(value, key) == 0) { logger.trace("Removing node '{0}' from '{1}' index with value '{2}'", nodeKey, name, value); keysByValue.remove(key); } } } protected  LocalUniqueIndex( String name,
                                String workspaceName,
                                DB db,
                                Converter<T> converter,
                                BTreeKeySerializer<T> valueSerializer,
                                Serializer<T> rawSerializer ); @Override void add( String nodeKey,
                     String propertyName, 
                     T value ); @Override void remove( String nodeKey,
                        String propertyName, 
                        T value ); @Override void remove( String nodeKey );  }
@Test public void shouldAllowRemovingAllValuesForKey() { LocalUniqueIndex<Long> index = uniqueValueIndex(Long.class); loadLongIndex(index, 10); assertThat(index.estimateTotalCount(), is(10L)); assertMatch(index, Operator.EQUAL_TO, 20L, key(2)); index.remove(key(2)); assertNoMatch(index, Operator.EQUAL_TO, 20L); assertThat(index.estimateTotalCount(), is(9L)); assertNoMatch(index, Operator.EQUAL_TO, 200L); index.remove(key(20)); assertNoMatch(index, Operator.EQUAL_TO, 200L); assertThat(index.estimateTotalCount(), is(9L)); index.remove(key(3), null, 30L); assertNoMatch(index, Operator.EQUAL_TO, 30L); assertThat(index.estimateTotalCount(), is(8L)); index.remove(key(3), null, 3000L); assertNoMatch(index, Operator.EQUAL_TO, 30L); assertThat(index.estimateTotalCount(), is(8L)); }