mirror of
https://github.com/apache/commons-lang.git
synced 2025-02-12 13:05:06 +00:00
Document (wrong?) behavior of xor methods
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/lang/trunk@1532031 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
469d0dd52a
commit
01fce8e321
@ -1028,6 +1028,14 @@ public static Boolean or(final Boolean... array) {
|
||||
* BooleanUtils.xor(true, false) = true
|
||||
* </pre>
|
||||
*
|
||||
* <p>Note that this method behaves different from using the binary XOR operator (^). Instead of combining the given
|
||||
* booleans using the XOR operator from left to right, this method counts the appearances of true in the given
|
||||
* array. It will only return true if exactly one boolean in the given array is true:</p>
|
||||
* <pre>
|
||||
* true ^ true ^ false ^ true = true
|
||||
* BooleanUtils.xor(true, true, false, true) = false
|
||||
* </pre>
|
||||
*
|
||||
* @param array an array of {@code boolean}s
|
||||
* @return {@code true} if the xor is successful.
|
||||
* @throws IllegalArgumentException if {@code array} is {@code null}
|
||||
@ -1069,6 +1077,9 @@ public static boolean xor(final boolean... array) {
|
||||
* BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE }) = Boolean.TRUE
|
||||
* </pre>
|
||||
*
|
||||
* <p>Note that this method behaves different from using the binary XOR operator (^). See
|
||||
* {@link #xor(boolean...)}.</p>
|
||||
*
|
||||
* @param array an array of {@code Boolean}s
|
||||
* @return {@code true} if the xor is successful.
|
||||
* @throws IllegalArgumentException if {@code array} is {@code null}
|
||||
|
Loading…
x
Reference in New Issue
Block a user