Class AndPredicate<T>

  • All Implemented Interfaces:
    com.google.common.base.Predicate<T>, Predicate<T>

    public class AndPredicate<T>
    extends Object
    implements com.google.common.base.Predicate<T>
    Special implementation of Predicate. Returns a predicate that evaluates to true if each of its components evaluates to true. The components are evaluated in order, and evaluation will be "short-circuited" as soon as a false predicate is found. It defensively copies the iterable passed in, so future changes to it won't alter the behavior of this predicate. If components is empty, the returned predicate will always evaluate to true.
    • Constructor Detail

      • AndPredicate

        public AndPredicate​(Collection<com.google.common.base.Predicate<T>> predicates)
        Constructor
        Parameters:
        predicates - initial collection of predicates, can't be null
      • AndPredicate

        public AndPredicate​(com.google.common.base.Predicate<T> predicate)
        Constructor
        Parameters:
        predicates - initial predicate, can't be null
    • Method Detail

      • apply

        public boolean apply​(T input)
        Specified by:
        apply in interface com.google.common.base.Predicate<T>
      • addPredicate

        public void addPredicate​(com.google.common.base.Predicate<T> predicate)
        Adds predicate for evaluating
        Parameters:
        predicate - adding predicate, can't be null
      • getPredicates

        public Collection<com.google.common.base.Predicate<T>> getPredicates()
        Gets all containing predicates
        Returns:
        collection of the containing predicates, never null