Codota Logo
BooleanUtils.xor
Code IndexAdd Codota to your IDE (free)

How to use
xor
method
in
org.apache.commons.lang3.BooleanUtils

Best Java code snippets using org.apache.commons.lang3.BooleanUtils.xor (Showing top 16 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Gson g =
  • Codota Iconnew Gson()
  • Codota IconGsonBuilder gsonBuilder;gsonBuilder.create()
  • Codota Iconnew GsonBuilder().create()
  • Smart code suggestions by Codota
}
origin: org.apache.commons/commons-lang3

/**
 * <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}s
 * @return {@code true} if the xor is successful.
 * @throws IllegalArgumentException if {@code array} is {@code null}
 * @throws IllegalArgumentException if {@code array} is empty.
 * @throws IllegalArgumentException if {@code array} contains a {@code null}
 */
public static Boolean xor(final Boolean... array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  }
  if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  try {
    final boolean[] primitive = ArrayUtils.toPrimitive(array);
    return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
  } catch (final NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void testXor_primitive_nullInput() {
  BooleanUtils.xor((boolean[]) null);
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void testXor_object_nullInput() {
  BooleanUtils.xor((Boolean[]) null);
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void testXor_object_nullElementInput() {
  BooleanUtils.xor(new Boolean[] {null});
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void testXor_primitive_emptyInput() {
  BooleanUtils.xor(new boolean[] {});
}
origin: org.apache.commons/commons-lang3

@Test(expected = IllegalArgumentException.class)
public void testXor_object_emptyInput() {
  BooleanUtils.xor(new Boolean[] {});
}
origin: org.apache.commons/commons-lang3

@Test
public void testXor_primitive_validInput_2items() {
  assertEquals(
    "true ^ true",
    true ^ true ,
    BooleanUtils.xor(new boolean[] { true, true }));
  assertEquals(
    "false ^ false",
    false ^ false,
    BooleanUtils.xor(new boolean[] { false, false }));
  assertEquals(
    "true ^ false",
    true ^ false,
    BooleanUtils.xor(new boolean[] { true, false }));
  assertEquals(
    "false ^ true",
    false ^ true,
    BooleanUtils.xor(new boolean[] { false, true }));
}
origin: org.apache.commons/commons-lang3

@Test
public void testXor_object_validInput_2items() {
  assertEquals(
    "false ^ false",
    false ^ false,
    BooleanUtils
      .xor(new Boolean[] { Boolean.FALSE, Boolean.FALSE })
      .booleanValue());
  assertEquals(
    "false ^ true",
    false ^ true,
    BooleanUtils
      .xor(new Boolean[] { Boolean.FALSE, Boolean.TRUE })
      .booleanValue());
  assertEquals(
    "true ^ false",
    true ^ false,
    BooleanUtils
      .xor(new Boolean[] { Boolean.TRUE, Boolean.FALSE })
      .booleanValue());
  assertEquals(
    "true ^ true",
    true ^ true,
    BooleanUtils
      .xor(new Boolean[] { Boolean.TRUE, Boolean.TRUE })
      .booleanValue());
}
origin: org.apache.commons/commons-lang3

"false ^ false ^ false",
false ^ false ^ false,
BooleanUtils.xor(new boolean[] { false, false, false }));
BooleanUtils.xor(new boolean[] { false, false, true }));
BooleanUtils.xor(new boolean[] { false, true, false }));
BooleanUtils.xor(new boolean[] { false, true, true }));
BooleanUtils.xor(new boolean[] { true, false, false }));
BooleanUtils.xor(new boolean[] { true, false, true }));
BooleanUtils.xor(new boolean[] { true, true, false }));
BooleanUtils.xor(new boolean[] { true, true, true }));
origin: org.apache.commons/commons-lang3

  "false ^ false ^ false",
  false ^ false ^ false,
  BooleanUtils.xor(
      new Boolean[] {
          Boolean.FALSE,
false ^ false ^ true,
BooleanUtils
  .xor(
    new Boolean[] {
      Boolean.FALSE,
false ^ true ^ false,
BooleanUtils
  .xor(
    new Boolean[] {
      Boolean.FALSE,
true ^ false ^ false,
BooleanUtils
  .xor(
    new Boolean[] {
      Boolean.TRUE,
  "true ^ false ^ true",
  true ^ false ^ true,
  BooleanUtils.xor(
      new Boolean[] {
          Boolean.TRUE,
origin: com.vmware.card-connectors/connectors-config

@Bean
public String vIdmPubKey(@Value("${security.oauth2.resource.jwt.key-uri:}") String vIdmPubKeyUrl,
             @Value("${security.oauth2.resource.jwt.key-value:}") String vIdmPubKeyValue) {
  if (!BooleanUtils.xor(new boolean[]{StringUtils.isEmpty(vIdmPubKeyUrl), StringUtils.isEmpty(vIdmPubKeyValue)})) {
    throw new IllegalArgumentException("Exactly one of security.oauth2.resource.jwt.key-uri/value must be configured");
  }
  return vIdmPubKeyUrl;
}
origin: io.virtdata/virtdata-lib-realer

/**
 * <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}s
 * @return {@code true} if the xor is successful.
 * @throws IllegalArgumentException if {@code array} is {@code null}
 * @throws IllegalArgumentException if {@code array} is empty.
 * @throws IllegalArgumentException if {@code array} contains a {@code null}
 */
public static Boolean xor(final Boolean... array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  }
  if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  try {
    final boolean[] primitive = ArrayUtils.toPrimitive(array);
    return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
  } catch (final NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
}
origin: de.knightsoft-net/gwt-commons-lang3

/**
 * <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}s
 * @return {@code true} if the xor is successful.
 * @throws IllegalArgumentException if {@code array} is {@code null}
 * @throws IllegalArgumentException if {@code array} is empty.
 * @throws IllegalArgumentException if {@code array} contains a {@code null}
 */
public static Boolean xor(final Boolean... array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  }
  if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  try {
    final boolean[] primitive = ArrayUtils.toPrimitive(array);
    return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
  } catch (final NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
}
origin: io.virtdata/virtdata-lib-curves4

/**
 * <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}s
 * @return {@code true} if the xor is successful.
 * @throws IllegalArgumentException if {@code array} is {@code null}
 * @throws IllegalArgumentException if {@code array} is empty.
 * @throws IllegalArgumentException if {@code array} contains a {@code null}
 */
public static Boolean xor(final Boolean... array) {
  if (array == null) {
    throw new IllegalArgumentException("The Array must not be null");
  }
  if (array.length == 0) {
    throw new IllegalArgumentException("Array is empty");
  }
  try {
    final boolean[] primitive = ArrayUtils.toPrimitive(array);
    return xor(primitive) ? Boolean.TRUE : Boolean.FALSE;
  } catch (final NullPointerException ex) {
    throw new IllegalArgumentException("The array must not contain any null elements");
  }
}
origin: torakiki/sejda

if (!BooleanUtils.xor(new boolean[] { taskCliArguments.isDirectory(), taskCliArguments.isFiles(),
    taskCliArguments.isFilesListConfig() })) {
  throw new SejdaRuntimeException(
origin: com.erudika/para

boolean isUpvote = upDown.equals(VoteValue.UP);
boolean wasUpvote = VoteValue.UP.toString().equals(saved.getValue());
boolean voteHasChanged = BooleanUtils.xor(new boolean[]{isUpvote, wasUpvote});
org.apache.commons.lang3BooleanUtilsxor

Javadoc

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 

Popular methods of BooleanUtils

  • toBoolean
    Converts a String to a Boolean throwing an exception if no match found. BooleanUtils.toBoolean("t
  • isTrue
    Checks if a Boolean value is true, handling null by returning false. BooleanUtils.isTrue(Boolean.
  • toBooleanObject
    Converts a String to a Boolean throwing an exception if no match. NOTE: This returns null and will
  • isFalse
    Checks if a Boolean value is false, handling null by returning false. BooleanUtils.isFalse(Boolea
  • isNotTrue
    Checks if a Boolean value is not true, handling null by returning true. BooleanUtils.isNotTrue(Bo
  • toStringTrueFalse
    Converts a boolean to a String returning 'true'or 'false'. BooleanUtils.toStringTrueFalse(true)
  • toBooleanDefaultIfNull
    Converts a Boolean to a boolean handling null. BooleanUtils.toBooleanDefaultIfNull(Boolean.TRUE,
  • toString
    Converts a boolean to a String returning one of the input Strings. BooleanUtils.toString(true, "t
  • isNotFalse
    Checks if a Boolean value is not false, handling null by returning true. BooleanUtils.isNotFalse(
  • or
    Performs an or on a set of booleans. BooleanUtils.or(true, true) = true BooleanUtils.or
  • and
    Performs an and on a set of booleans. BooleanUtils.and(true, true) = true BooleanUtils.a
  • toStringYesNo
    Converts a boolean to a String returning 'yes'or 'no'. BooleanUtils.toStringYesNo(true) = "yes"
  • and,
  • toStringYesNo,
  • toInteger,
  • compare,
  • negate,
  • toStringOnOff,
  • <init>,
  • toIntegerObject

Popular in Java

  • Making http post requests using okhttp
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • getSharedPreferences (Context)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • PrintStream (java.io)
    A PrintStream adds functionality to another output stream, namely the ability to print representatio
  • Executors (java.util.concurrent)
    Factory and utility methods for Executor, ExecutorService, ScheduledExecutorService, ThreadFactory,
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Collectors (java.util.stream)
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now