From fe14e51d00ad7f190ee83a58542dbd3fd6304a3d Mon Sep 17 00:00:00 2001 From: Tom Wojciechowski Date: Sat, 25 May 2024 00:38:51 +0100 Subject: [PATCH] fix for robovm compatibility --- .../com/talosvfx/talos/runtime/utils/NamingUtils.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runtimes/talos/src/main/java/com/talosvfx/talos/runtime/utils/NamingUtils.java b/runtimes/talos/src/main/java/com/talosvfx/talos/runtime/utils/NamingUtils.java index 065a88139..9511de138 100644 --- a/runtimes/talos/src/main/java/com/talosvfx/talos/runtime/utils/NamingUtils.java +++ b/runtimes/talos/src/main/java/com/talosvfx/talos/runtime/utils/NamingUtils.java @@ -3,7 +3,6 @@ import com.badlogic.gdx.utils.GdxRuntimeException; import java.util.Collection; -import java.util.function.Predicate; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -29,8 +28,12 @@ public static String getNewName (String newNameAttempt, Collection poten } Pattern duplicatePattern = Pattern.compile(newNameAttempt + "\\([0-9]*\\)$"); - Predicate predicate = duplicatePattern.asPredicate(); - long count = potentialConflicts.stream().filter(predicate).count(); + long count = 0; + for (String potentialConflict : potentialConflicts) { + if (duplicatePattern.matcher(potentialConflict).find()) { + count++; + } + } if (count > 0) { //We have things that match our regex