From 3f872463b677ba4bf678b234c2355e9673bceff8 Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 28 Sep 2021 12:26:44 +0200 Subject: [PATCH] Fixed a Rule Break with the new ComputeIfAbsent function --- Changelog.md | 2 +- src/builder/java/speiger/src/builder/GlobalVariables.java | 1 + .../collections/templates/maps/abstracts/AbstractMap.template | 2 +- .../templates/maps/impl/customHash/OpenCustomHashMap.template | 2 +- .../collections/templates/maps/impl/hash/OpenHashMap.template | 2 +- .../templates/maps/impl/immutable/ImmutableOpenHashMap.template | 2 +- .../collections/templates/maps/impl/misc/ArrayMap.template | 2 +- .../collections/templates/maps/impl/tree/AVLTreeMap.template | 2 +- .../collections/templates/maps/impl/tree/RBTreeMap.template | 2 +- .../assets/collections/templates/maps/interfaces/Map.template | 2 +- 10 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Changelog.md b/Changelog.md index be5ff279..bdb50bb5 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,7 +5,7 @@ - Added: addAll with Array-types in collections. - Added: Java Iterator/Iterable support for Stream replacing methods - Added: Suppliers. -- Added: ComputeIfAbsent but value generator is a supplier +- Added: SupplyIfAbsent but value generator is a supplier ### Version 0.4.0 - Changed: Iterable specific helper functions were moved out of Iterators and moved into Iterables diff --git a/src/builder/java/speiger/src/builder/GlobalVariables.java b/src/builder/java/speiger/src/builder/GlobalVariables.java index f0adad82..80e14ae3 100644 --- a/src/builder/java/speiger/src/builder/GlobalVariables.java +++ b/src/builder/java/speiger/src/builder/GlobalVariables.java @@ -290,6 +290,7 @@ public class GlobalVariables addFunctionValueMappers("REPLACE_VALUES", valueType.isObject() ? "replaceObjects" : "replace%ss"); addFunctionMappers("REPLACE", type.isObject() ? "replaceObjects" : "replace%ss"); addFunctionMappers("SORT", "sort%ss"); + addFunctionValueMappers("SUPPLY_IF_ABSENT", "supply%sIfAbsent"); addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get"); addSimpleMapper("TEST_VALUE", type.isObject() ? "getBoolean" : "get"); addSimpleMapper("NEW_STREAM", type.isPrimitiveBlocking() ? "" : type.getCustomJDKType().getKeyType()+"Stream"); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template index c4bf3291..aeff52d7 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template @@ -191,7 +191,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap