Koloboke icon indicating copy to clipboard operation
Koloboke copied to clipboard

Incorrect behavior of MutableLHashSeparateKVLongObjMapGO cursor

Open marespane opened this issue 4 years ago • 0 comments

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<String> 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<String> 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.

marespane avatar Aug 22 '19 07:08 marespane