Small fixes.

-Fixed: Some imports.
-Fixed: containsValue for OpenHashMap was not checking nullEntry properly
This commit is contained in:
Speiger 2022-04-14 05:37:41 +02:00
parent e69c675f82
commit ede40f06d0
4 changed files with 15 additions and 5 deletions

View File

@ -7,7 +7,6 @@ import java.util.AbstractCollection;
import java.util.function.Consumer; import java.util.function.Consumer;
#endif #endif
import speiger.src.collections.PACKAGE.collections.COLLECTION;
#if !TYPE_OBJECT #if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.functions.CONSUMER;
import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.utils.ITERATORS;

View File

@ -14,7 +14,6 @@ import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER;
import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR;
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
import speiger.src.collections.PACKAGE.lists.LIST; import speiger.src.collections.PACKAGE.lists.LIST;
import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.lists.ARRAY_LIST;
#if !TYPE_BOOLEAN #if !TYPE_BOOLEAN

View File

@ -316,6 +316,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
#if !VALUE_OBJECT #if !VALUE_OBJECT
@Override @Override
public boolean containsValue(VALUE_TYPE value) { public boolean containsValue(VALUE_TYPE value) {
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
for(int i = nullIndex;i >= 0;i--) for(int i = nullIndex;i >= 0;i--)
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && VALUE_EQUALS(values[i], value)) return true; if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && VALUE_EQUALS(values[i], value)) return true;
return false; return false;
@ -325,7 +326,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL
@Override @Override
@ValuePrimitive @ValuePrimitive
public boolean containsValue(Object value) { public boolean containsValue(Object value) {
for(int i = nullIndex;i >= 0;i--) #if VALUE_OBJECT
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
#else
if(containsNull && ((value == null && values[nullIndex] == getDefaultReturnValue()) || EQUALS_VALUE_TYPE(values[nullIndex], value))) return true;
#endif
for(int i = nullIndex-1;i >= 0;i--)
#if VALUE_OBJECT #if VALUE_OBJECT
if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && EQUALS_VALUE_TYPE(values[i], value)) return true; if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && EQUALS_VALUE_TYPE(values[i], value)) return true;
#else #else

View File

@ -287,7 +287,8 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
#if !VALUE_OBJECT #if !VALUE_OBJECT
@Override @Override
public boolean containsValue(VALUE_TYPE value) { public boolean containsValue(VALUE_TYPE value) {
for(int i = nullIndex;i >= 0;i--) if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
for(int i = nullIndex-1;i >= 0;i--)
if(KEY_EQUALS_NOT_NULL(keys[i]) && VALUE_EQUALS(values[i], value)) return true; if(KEY_EQUALS_NOT_NULL(keys[i]) && VALUE_EQUALS(values[i], value)) return true;
return false; return false;
} }
@ -296,7 +297,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE
@Override @Override
@ValuePrimitive @ValuePrimitive
public boolean containsValue(Object value) { public boolean containsValue(Object value) {
for(int i = nullIndex;i >= 0;i--) #if VALUE_OBJECT
if(containsNull && VALUE_EQUALS(values[nullIndex], value)) return true;
#else
if(containsNull && ((value == null && values[nullIndex] == getDefaultReturnValue()) || EQUALS_VALUE_TYPE(values[nullIndex], value))) return true;
#endif
for(int i = nullIndex-1;i >= 0;i--)
#if VALUE_OBJECT #if VALUE_OBJECT
if(KEY_EQUALS_NOT_NULL(keys[i]) && EQUALS_VALUE_TYPE(values[i], value)) return true; if(KEY_EQUALS_NOT_NULL(keys[i]) && EQUALS_VALUE_TYPE(values[i], value)) return true;
#else #else