/** * Implements a negated exists. * <p> * Returns <strong>false</strong> when at least one of the elements of the list * <strong>matches</strong> the target. * The list may contain both objects (equals) and UnaryTests (apply) */ public static Boolean notExists( EvaluationContext ctx, List tests, Object target) { for (Object test : tests) { Boolean r = applyUnaryTest(ctx, test, target); if (r == null || r) { return false; } } return true; }
/** * Returns true when at least one of the elements of the list matches the target. * The list may contain both objects (equals) and UnaryTests (apply) */ public static Boolean exists( EvaluationContext ctx, Object tests, Object target) { if (!(tests instanceof List)) { if (tests == null) { ctx.notifyEvt(() -> new ASTEventBase(FEELEvent.Severity.ERROR, Msg.createMessage(Msg.IS_NULL, "value"), null)); return null; } return applyUnaryTest(ctx, tests, target); } for (Object test : (List) tests) { Boolean r = applyUnaryTest(ctx, test, target); if (Boolean.TRUE.equals(r)) { return true; } } return false; }