forked from Speiger/Primitive-Collections
Fixed a bug where exact duplication would break immutableMaps/sets
This commit is contained in:
parent
9d17dc17fd
commit
4c68c925d3
|
@ -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;
|
int pos = HashUtil.mix(KEY_TO_HASH(o)) & newMask;
|
||||||
KEY_TYPE current = newKeys[pos];
|
KEY_TYPE current = newKeys[pos];
|
||||||
if(KEY_EQUALS_NOT_NULL(current)) {
|
if(KEY_EQUALS_NOT_NULL(current)) {
|
||||||
if(KEY_EQUALS(current, o)) {
|
if(KEY_EQUALS(current, o)) continue;
|
||||||
found = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
while(KEY_EQUALS_NOT_NULL((current = newKeys[pos = (++pos & mask)]))) {
|
while(KEY_EQUALS_NOT_NULL((current = newKeys[pos = (++pos & mask)]))) {
|
||||||
if(KEY_EQUALS(current, o)) {
|
if(KEY_EQUALS(current, o)) {
|
||||||
found = false;
|
found = false;
|
||||||
|
|
|
@ -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;
|
int pos = HashUtil.mix(KEY_TO_HASH(o)) & newMask;
|
||||||
KEY_TYPE current = newKeys[pos];
|
KEY_TYPE current = newKeys[pos];
|
||||||
if(KEY_EQUALS_NOT_NULL(current)) {
|
if(KEY_EQUALS_NOT_NULL(current)) {
|
||||||
if(KEY_EQUALS(current, o)) {
|
if(KEY_EQUALS(current, o)) continue;
|
||||||
found = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
while(KEY_EQUALS_NOT_NULL((current = newKeys[pos = (++pos & mask)]))) {
|
while(KEY_EQUALS_NOT_NULL((current = newKeys[pos = (++pos & mask)]))) {
|
||||||
if(KEY_EQUALS(current, o)) {
|
if(KEY_EQUALS(current, o)) {
|
||||||
found = false;
|
found = false;
|
||||||
|
|
Loading…
Reference in New Issue