diff --git a/hope-core/src/main/java/io/appform/hope/core/visitors/Evaluator.java b/hope-core/src/main/java/io/appform/hope/core/visitors/Evaluator.java index 70f5942..539f1a8 100644 --- a/hope-core/src/main/java/io/appform/hope/core/visitors/Evaluator.java +++ b/hope-core/src/main/java/io/appform/hope/core/visitors/Evaluator.java @@ -72,18 +72,24 @@ public List evaluate( final List evaluatables, final JsonNode node) { val logicEvaluator = new LogicEvaluator(new EvaluationContext(parseContext.parse(node), node, this)); - return evaluatables.stream() - .map(evaluatable -> evaluatable.accept(logicEvaluator)) - .collect(Collectors.toList()); + List list = new ArrayList<>(); + for (Evaluatable evaluatable : evaluatables) { + list.add(evaluatable.accept(logicEvaluator)); + } + return list; } public OptionalInt evaluateFirst( final List rules, final JsonNode node) { val logicEvaluator = new LogicEvaluator(new EvaluationContext(parseContext.parse(node), node, this)); - return IntStream.range(0, rules.size()) - .filter(index -> rules.get(index).accept(logicEvaluator)) - .findFirst(); + int bound = rules.size(); + for (int index = 0; index < bound; index++) { + if (rules.get(index).accept(logicEvaluator)) { + return OptionalInt.of(index); + } + } + return OptionalInt.empty(); } @Data