Apache下commons-lang工具包下BooleanUtils类的xor(true, true, true)结果为false,而System.out.println(true ^ true ^ true)的结果为true。为什么?
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);
}
}
/*
result:
false
false
true
*/