leventov / Koloboke

Java Collections till the last breadcrumb of memory and performance
https://koloboke.com/
1k stars 138 forks source link

Incorrect behavior of MutableLHashSeparateKVLongObjMapGO cursor #69

Open marespane opened 5 years ago

marespane commented 5 years ago

Hello @leventov ,

Found an issue when using the cursor to modify the MutableLHashSeparateKVLongObjMapGO map. The following snippet can be used to replicate the issue:

`HashLongObjMap map = HashLongObjMaps.newMutableMap(); map.put(108, "null"); map.put(117, "null"); map.put(116, "null"); map.put(146, "null"); map.put(131, "null"); map.put(111, "null"); map.put(113, "null"); map.put(173, "null"); map.put(107, "null"); map.put(110, "null"); map.put(118, "null"); map.put(109, "null"); map.put(114, "null"); map.put(185, "null"); map.put(112, "null"); map.put(177, "null"); map.put(135, "null"); map.put(115, "null"); map.put(186, "null"); LongObjCursor cursor = map.cursor();

    while (cursor.moveNext()) {
        long key = cursor.key();
        if (key == 177 || key == 186 || key == 185 || key == 173) {
            cursor.remove();
        } else {
            cursor.setValue(String.valueOf(key));
        }
    }

    System.out.println(map);`

The output is that key 109 has value "null" instead of "109".

The version used is koloboke-impl-jdk8-1.0.0.