Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[COLLECTIONS-734] Update EntryIterator.remove() to fix bug #115

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -946,8 +946,8 @@ public void remove() {
if (currentEntry == null) {
throw new IllegalStateException(AbstractHashedMap.REMOVE_INVALID);
}
currentEntry.setRemoved(true);
parent.remove(currentEntry.getKey());
currentEntry.setRemoved(true);
nextIndex--;
currentEntry = null;
}
Expand Down
Expand Up @@ -336,6 +336,23 @@ public void testMapIteratorSetValue3() throws Exception {
assertEquals("NewValue", map.get(THREE));
}

public void testEntrySet() {
final Flat3Map<K, V> map = new Flat3Map<>();
map.put((K) "A", (V) "one");
map.put((K) "B", (V) "two");
map.put((K) "C", (V) "three");
Iterator<Map.Entry<K, V>> it = map.entrySet().iterator();

Map.Entry<K, V> mapEntry1 = it.next();
Map.Entry<K, V> mapEntry2 = it.next();
Map.Entry<K, V> mapEntry3 = it.next();
it.remove();
assertEquals(2, map.size());
assertEquals("one", map.get((K) "A"));
assertEquals("two", map.get((K) "B"));
assertEquals(null, map.get((K) "C"));
}

//-----------------------------------------------------------------------
@Override
public BulkTest bulkTestMapIterator() {
Expand Down