/** * Provides predicate (not peer-deployable) which returns {@code true} if it receives an element * that is contained in the passed in collection. * * @param c Collection used for predicate filter. * @param <T> Element type. * @return Predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. */ public static <T> IgnitePredicate<T> contains(@Nullable final Collection<T> c) { return c == null || c.isEmpty() ? GridFunc.<T>alwaysFalse() : new P1<T>() { @Override public boolean apply(T t) { return c.contains(t); } }; }
/** * Provides predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. * * @param c Collection used for predicate filter. * @param <T> Element type. * @return Predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. */ public static <T> IgnitePredicate<T> contains(@Nullable final Collection<T> c) { return c == null || c.isEmpty() ? GridFunc.<T>alwaysFalse() : new ContainsPredicate(c); }
/** * Gets predicate (not peer-deployable) that returns {@code true} if its free variable is contained * in given collection. * * @param c Collection to check for containment. * @param <T> Type of the free variable for the predicate and type of the * collection elements. * @return Predicate (not peer-deployable) that returns {@code true} if its free variable is * contained in given collection. */ public static <T> IgnitePredicate<T> in(@Nullable final Collection<? extends T> c) { return F.isEmpty(c) ? GridFunc.<T>alwaysFalse() : new P1<T>() { @Override public boolean apply(T t) { return c.contains(t); } }; }
/** * Creates grid node predicate evaluating on the given node IDs. * * @param nodeIds Collection of node IDs. * @return Grid node predicate evaluating on the given node IDs. * @see #idForNodeId(UUID) * @see #nodeIds(Collection) */ public static <T extends ClusterNode> IgnitePredicate<T> nodeForNodeIds(@Nullable final Collection<UUID> nodeIds) { if (isEmpty(nodeIds)) return alwaysFalse(); return new ContainsNodeIdsPredicate<>(nodeIds); }
/** * Provides predicate (not peer-deployable) which returns {@code true} if it receives an element * that is contained in the passed in collection. * * @param c Collection used for predicate filter. * @param <T> Element type. * @return Predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. */ public static <T> IgnitePredicate<T> contains(@Nullable final Collection<T> c) { return c == null || c.isEmpty() ? GridFunc.<T>alwaysFalse() : new P1<T>() { @Override public boolean apply(T t) { return c.contains(t); } }; }
/** * Provides predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. * * @param c Collection used for predicate filter. * @param <T> Element type. * @return Predicate which returns {@code true} if it receives an element * that is contained in the passed in collection. */ public static <T> IgnitePredicate<T> contains(@Nullable final Collection<T> c) { return c == null || c.isEmpty() ? GridFunc.<T>alwaysFalse() : new ContainsPredicate(c); }
/** * Gets predicate (not peer-deployable) that returns {@code true} if its free variable is contained * in given collection. * * @param c Collection to check for containment. * @param <T> Type of the free variable for the predicate and type of the * collection elements. * @return Predicate (not peer-deployable) that returns {@code true} if its free variable is * contained in given collection. */ public static <T> IgnitePredicate<T> in(@Nullable final Collection<? extends T> c) { return F.isEmpty(c) ? GridFunc.<T>alwaysFalse() : new P1<T>() { @Override public boolean apply(T t) { return c.contains(t); } }; }
/** * Creates grid node predicate evaluating on the given node IDs. * * @param nodeIds Collection of node IDs. * @return Grid node predicate evaluating on the given node IDs. * @see #idForNodeId(UUID) * @see #nodeIds(Collection) */ public static <T extends ClusterNode> IgnitePredicate<T> nodeForNodeIds(@Nullable final Collection<UUID> nodeIds) { if (isEmpty(nodeIds)) return alwaysFalse(); return new ContainsNodeIdsPredicate<>(nodeIds); }