From c886a9e58be87b9a23cc42afb23924fa84866b91 Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 8 Nov 2023 14:42:21 +0530 Subject: [PATCH] Using forloop instead of streams --- .../appform/hope/core/utils/Converters.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/hope-core/src/main/java/io/appform/hope/core/utils/Converters.java b/hope-core/src/main/java/io/appform/hope/core/utils/Converters.java index 39263d5..3a4c906 100644 --- a/hope-core/src/main/java/io/appform/hope/core/utils/Converters.java +++ b/hope-core/src/main/java/io/appform/hope/core/utils/Converters.java @@ -25,12 +25,25 @@ import io.appform.hope.core.exceptions.errorstrategy.ErrorHandlingStrategy; import io.appform.hope.core.functions.FunctionRegistry; import io.appform.hope.core.functions.HopeFunction; -import io.appform.hope.core.values.*; +import io.appform.hope.core.values.ArrayValue; +import io.appform.hope.core.values.BooleanValue; +import io.appform.hope.core.values.FunctionValue; +import io.appform.hope.core.values.JsonPathValue; +import io.appform.hope.core.values.JsonPointerValue; +import io.appform.hope.core.values.NumericValue; +import io.appform.hope.core.values.ObjectValue; +import io.appform.hope.core.values.StringValue; import io.appform.hope.core.visitors.Evaluator; import lombok.extern.slf4j.Slf4j; +import lombok.val; import java.lang.reflect.Constructor; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Spliterator; +import java.util.Spliterators; import java.util.function.Function; import java.util.function.Supplier; import java.util.stream.StreamSupport; @@ -705,10 +718,12 @@ private static List arrayToObjectList( Evaluator.EvaluationContext evaluationContext, List values, Object defaultValue) { - return values - .stream() - .map(value -> objectValue(evaluationContext, value, defaultValue)) - .toList(); + val list = new ArrayList<>(); + for (final Value value : values) { + val o = objectValue(evaluationContext, value, defaultValue); + list.add(o); + } + return list; } }