New Features.

-Added: Suppliers.
-Added: ComputeIfAbsent but value generator is a supplier
This commit is contained in:
2021-09-28 12:06:51 +02:00
parent 49c5e9eadd
commit 531443531d
12 changed files with 132 additions and 4 deletions
@@ -33,6 +33,7 @@ import speiger.src.collections.PACKAGE.sets.SET;
#if !SAME_TYPE
import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR;
#endif
import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER;
import speiger.src.collections.objects.collections.ObjectIterator;
#if !TYPE_OBJECT
import speiger.src.collections.objects.sets.ObjectSet;
@@ -267,6 +268,14 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
* @return the result of the computed value or present value
*/
public VALUE_TYPE COMPUTE_IF_ABSENT(KEY_TYPE key, FUNCTION KEY_VALUE_GENERIC_TYPE mappingFunction);
/**
* A Supplier based computeIfAbsent function to fill the most used usecase of this function
* @param key the key that should be computed
* @param valueProvider the value if not present
* @return the result of the computed value or present value
*/
public VALUE_TYPE COMPUTE_IF_ABSENT(KEY_TYPE key, VALUE_SUPPLIER VALUE_GENERIC_TYPE valueProvider);
/**
* A Type Specific compute method to reduce boxing/unboxing
* @param key the key that should be computed