org.apache.commons.lang.BooleanUtils.xor()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(130)

本文整理了Java中org.apache.commons.lang.BooleanUtils.xor()方法的一些代码示例,展示了BooleanUtils.xor()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。BooleanUtils.xor()方法的具体详情如下:
包路径:org.apache.commons.lang.BooleanUtils
类名称:BooleanUtils
方法名:xor

BooleanUtils.xor介绍

[英]Performs an xor on an array of Booleans.

BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE 
BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE 
BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE

[中]

代码示例

代码示例来源:origin: commons-lang/commons-lang

/**
 * <p>Performs an xor on an array of Booleans.</p>
 * 
 * <pre>
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE
 * </pre>
 *
 * @param array  an array of <code>Boolean<code>s
 * @return <code>true</code> if the xor is successful.
 * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>array</code> is empty.
 * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
 */
public static Boolean xor(Boolean[] array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  } else if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  boolean[] primitive = null;
  try {
    primitive = ArrayUtils.toPrimitive(array);
  } catch (NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
  return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
}

代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.commons.lang

/**
 * <p>Performs an xor on an array of Booleans.</p>
 * 
 * <pre>
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE
 * </pre>
 *
 * @param array  an array of <code>Boolean<code>s
 * @return <code>true</code> if the xor is successful.
 * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>array</code> is empty.
 * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
 */
public static Boolean xor(Boolean[] array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  } else if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  boolean[] primitive = null;
  try {
    primitive = ArrayUtils.toPrimitive(array);
  } catch (NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
  return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics

/**
 * <p>Performs an xor on an array of Booleans.</p>
 * 
 * <pre>
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE
 * </pre>
 *
 * @param array  an array of <code>Boolean<code>s
 * @return <code>true</code> if the xor is successful.
 * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>array</code> is empty.
 * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
 */
public static Boolean xor(Boolean[] array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  } else if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  boolean[] primitive = null;
  try {
    primitive = ArrayUtils.toPrimitive(array);
  } catch (NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
  return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
}

代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.lang

/**
 * <p>Performs an xor on an array of Booleans.</p>
 * 
 * <pre>
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE
 * </pre>
 *
 * @param array  an array of <code>Boolean<code>s
 * @return <code>true</code> if the xor is successful.
 * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>array</code> is empty.
 * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
 */
public static Boolean xor(Boolean[] array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  } else if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  boolean[] primitive = null;
  try {
    primitive = ArrayUtils.toPrimitive(array);
  } catch (NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
  return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
}

代码示例来源:origin: org.apache.directory.api/api-ldap-client-all

/**
 * <p>Performs an xor on an array of Booleans.</p>
 * 
 * <pre>
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE
 * </pre>
 *
 * @param array  an array of <code>Boolean<code>s
 * @return <code>true</code> if the xor is successful.
 * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>array</code> is empty.
 * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
 */
public static Boolean xor(Boolean[] array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  } else if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  boolean[] primitive = null;
  try {
    primitive = ArrayUtils.toPrimitive(array);
  } catch (NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
  return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
}

代码示例来源:origin: com.alibaba.citrus.tool/antx-autoexpand

/**
 * <p>Performs an xor on an array of Booleans.</p>
 * 
 * <pre>
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })   = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE }) = Boolean.FALSE
 *   BooleanUtils.xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })  = Boolean.TRUE
 * </pre>
 *
 * @param array  an array of <code>Boolean<code>s
 * @return <code>true</code> if the xor is successful.
 * @throws IllegalArgumentException if <code>array</code> is <code>null</code>
 * @throws IllegalArgumentException if <code>array</code> is empty.
 * @throws IllegalArgumentException if <code>array</code> contains a <code>null</code>
 */
public static Boolean xor(Boolean[] array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  } else if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  boolean[] primitive = null;
  try {
    primitive = ArrayUtils.toPrimitive(array);
  } catch (NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
  return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
}

相关文章