Version: 3.2.0
Using a simple map as example with an item with a key = 0 (the NO_KEY),
operations like get(0) and remove(0) works as expected
final NonBlockingHashMapLong<String> map = new NonBlockingHashMapLong<>();
map.put(123L, "hello");
map.put(456L, "world");
map.put(0L, "zero");
but trying to remove the NO_KEY via iterator() does not produce any exception, but the item is not removed.
final Iterator<String> itValue = map.values().iterator();
while (itValue.hasNext()) {
final String value = itValue.next();
if (value.equals("zero")) {
System.out.println("removing zero");
itValue.remove();
}
}
System.out.println(map); // {0=zero, 456=world, 123=hello}
final Iterator<Long> itKey = map.keySet().iterator();
while (itKey.hasNext()) {
final Long key = itKey.next();
if (key == 0) {
System.out.println("removing zero");
itKey.remove();
}
}
System.out.println(map); // {0=zero, 456=world, 123=hello}
final Iterator<Entry<Long, String>> itEntry = map.entrySet().iterator();
while (itEntry.hasNext()) {
final Entry<Long, String> entry = itEntry.next();
if (entry.getKey() == 0) {
System.out.println("removing zero");
itEntry.remove();
}
}
System.out.println(map); // {0=zero, 456=world, 123=hello}
Using directly the remove() works as expected
String v = map.remove(0); // v=zero
System.out.println(map); // {456=world, 123=hello}
Version: 3.2.0
Using a simple map as example with an item with a key = 0 (the NO_KEY),
operations like get(0) and remove(0) works as expected
but trying to remove the NO_KEY via iterator() does not produce any exception, but the item is not removed.
Using directly the remove() works as expected