使用apache下的commons-lang工具包下的BooleanUtils类的xor方法对boolean数组中的boolean值进行异或运算,发现结果与期望的不一样,请问这是怎么回事呢?
public class Test {
public static void main(String[] args) {
System.out.println(org.apache.commons.lang.BooleanUtils.xor(new boolean[]{true, true, true}));
System.out.println(org.apache.commons.lang3.BooleanUtils.xor(new boolean[]{true, true, true}));
System.out.println(true ^ true ^ true);
}
}
/*
打印结果:
false
false
true
*/
```