public final class Xor extends ScalarEnvelope<Boolean>
True
when an odd number of elements have value true,
otherwise return False
.
This class could be also used for matching multiple boolean expressions:
new Xor(
new True(),
new True(),
new True()
).value(); // the result is true
new Xor(
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.
Copyright © 2017–2021 Cactoos. All rights reserved.