Class And

  • All Implemented Interfaces:
    Scalar<Boolean>

    public final class And
    extends Object
    implements Scalar<Boolean>
    Logical conjunction. This class performs short-circuit evaluation in which arguments are executed only if the preceding argument does not suffice to determine the value of the expression.

    This class could be also used for matching multiple boolean expressions:

    new And( new True(), new True(), new True() ).value(); // the result is true new And( new True(), new False(), new True() ).value(); // the result is false

    This class implements Scalar, which throws a checked Exception. This may not be convenient in many cases. To make it more convenient and get rid of the checked exception you can use the Unchecked decorator. Or you may use IoChecked to wrap it in an IOException.

    There is no thread-safety guarantee.

    Since:
    0.8
    See Also:
    Unchecked, IoChecked
    • Constructor Detail

      • And

        @SafeVarargs
        public And​(Func<? super X,​Boolean> func,
                   X... src)
        Ctor.
        Type Parameters:
        X - Type of items in the iterable
        Parameters:
        func - Func to map
        src - The iterable
      • And

        public And​(Func<? super X,​Boolean> func,
                   Iterable<? extends X> src)
        Ctor.
        Type Parameters:
        X - Type of items in the iterable
        Parameters:
        func - Func to map
        src - The iterable
        Since:
        0.24
      • And

        @SafeVarargs
        public And​(X subject,
                   Func<? super X,​Boolean>... conditions)
        Ctor.
        Type Parameters:
        X - Type of items in the iterable
        Parameters:
        subject - The subject
        conditions - Funcs to map
        Since:
        0.34
      • And

        public And​(X subject,
                   Iterable<? extends Func<? super X,​Boolean>> conditions)
        Ctor.
        Type Parameters:
        X - Type of items in the iterable
        Parameters:
        subject - The subject
        conditions - Funcs to map
        Since:
        0.49
      • And

        public And​(Iterable<? extends Scalar<Boolean>> iterable)
        Ctor.
        Parameters:
        iterable - The iterable.