@@ -0,0 +1,2804 @@
+/*%0A * The MIT License (MIT)%0A *%0A * Copyright (c) 2017-2020 Yegor Bugayenko%0A *%0A * Permission is hereby granted, free of charge, to any person obtaining a copy%0A * of this software and associated documentation files (the %22Software%22), to deal%0A * in the Software without restriction, including without limitation the rights%0A * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell%0A * copies of the Software, and to permit persons to whom the Software is%0A * furnished to do so, subject to the following conditions:%0A *%0A * The above copyright notice and this permission notice shall be included%0A * in all copies or substantial portions of the Software.%0A *%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,%0A * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE%0A * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER%0A * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,%0A * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE%0A * SOFTWARE.%0A */%0Apackage org.cactoos.scalar;%0A%0Aimport org.cactoos.Scalar;%0Aimport org.cactoos.list.ListOf;%0A%0A/**%0A * Logical exclusive or.%0A * This class performs short-circuit evaluation in which arguments are%0A * executed only if the preceding argument does not suffice to determine%0A * the value of the expression.%0A *%0A * %3Cp%3EThis class could be also used for matching multiple boolean%0A * expressions:%3C/p%3E%0A *%0A * %7B@code%0A * new Xor(%0A *    new True(),%0A *    new True(),%0A *    new True()%0A * ).value(); // the result is true%0A *%0A * new Xor(%0A *    new True(),%0A *    new False(),%0A *    new True()%0A * ).value(); // the result is false%0A * %7D%0A *%0A * %3Cp%3EThis class implements %7B@link Scalar%7D, which throws a checked%0A * %7B@link Exception%7D. This may not be convenient in many cases. To make%0A * it more convenient and get rid of the checked exception you can%0A * use the %7B@link Unchecked%7D decorator. Or you may use%0A * %7B@link IoChecked%7D to wrap it in an IOException.%3C/p%3E%0A *%0A * %3Cp%3EThere is no thread-safety guarantee.%0A *%0A * @see Unchecked%0A * @see IoChecked%0A * @since 0.49%0A */%0Apublic final class Xor implements Scalar%3CBoolean%3E %7B%0A%0A    /**%0A     * The iterable.%0A     */%0A    private final Iterable%3CScalar%3CBoolean%3E%3E origin;%0A%0A    /**%0A     * Ctor.%0A     * @param iterable The iterable.%0A     */%0A    public Xor(final Iterable%3CScalar%3CBoolean%3E%3E iterable) %7B%0A        this.origin = iterable;%0A    %7D%0A%0A    @Override%0A    public Boolean value() throws Exception %7B%0A        return new ListOf%3CScalar%3CBoolean%3E%3E(this.origin)%0A            .stream().reduce(%0A                new True(),%0A                (org, next) -%3E () -%3E org.value().booleanValue() %5E next.value().booleanValue()%0A            )%0A            .value();%0A    %7D%0A%7D%0A

add Xor -> Logical exclusive or