From 4c68c925d3b230599333e2e5443d6043f46d8cc0 Mon Sep 17 00:00:00 2001 From: Speiger Date: Fri, 25 Jun 2021 21:14:45 +0200 Subject: [PATCH] Fixed a bug where exact duplication would break immutableMaps/sets --- .../maps/impl/immutable/ImmutableOpenHashMap.template | 5 +---- .../collections/templates/sets/ImmutableOpenHashSet.template | 5 +---- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template index eb3c973..47886fd 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template @@ -214,10 +214,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int pos = HashUtil.mix(KEY_TO_HASH(o)) & newMask; KEY_TYPE current = newKeys[pos]; if(KEY_EQUALS_NOT_NULL(current)) { - if(KEY_EQUALS(current, o)) { - found = false; - break; - } + if(KEY_EQUALS(current, o)) continue; while(KEY_EQUALS_NOT_NULL((current = newKeys[pos = (++pos & mask)]))) { if(KEY_EQUALS(current, o)) { found = false; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template index a271306..dee7c15 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template @@ -187,10 +187,7 @@ public class IMMUTABLE_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERI int pos = HashUtil.mix(KEY_TO_HASH(o)) & newMask; KEY_TYPE current = newKeys[pos]; if(KEY_EQUALS_NOT_NULL(current)) { - if(KEY_EQUALS(current, o)) { - found = false; - break; - } + if(KEY_EQUALS(current, o)) continue; while(KEY_EQUALS_NOT_NULL((current = newKeys[pos = (++pos & mask)]))) { if(KEY_EQUALS(current, o)) { found = false;