And
See javadoc - uk.gov.gchq.koryphe.impl.binaryoperator.And
Available since Koryphe version 1.0.0
Applies the logical AND operation to 2 booleans
Examples
And with booleans
Java
JSON
Full JSON
final And and = new And();
{
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And"
}
{
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And"
}
Input type:
java.lang.Boolean
Example inputs:
Input Type | Inputs | Result Type | Result |
---|---|---|---|
java.lang.Boolean | true and true | java.lang.Boolean | true |
java.lang.Boolean | true and false | java.lang.Boolean | false |
java.lang.Boolean | false and false | java.lang.Boolean | false |
And with nulls
Java
JSON
Full JSON
final And and = new And();
{
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And"
}
{
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And"
}
Input type:
java.lang.Boolean
Example inputs:
Input Type | Inputs | Result Type | Result |
---|---|---|---|
java.lang.Boolean | false and null | java.lang.Boolean | false |
java.lang.Boolean | true and null | java.lang.Boolean | true |
null and null | null |
And with non boolean values
Java
JSON
Full JSON
final And and = new And();
{
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And"
}
{
"class" : "uk.gov.gchq.koryphe.impl.binaryoperator.And"
}
Input type:
java.lang.Boolean
Example inputs:
Input Type | Inputs | Result Type | Result |
---|---|---|---|
java.lang.String | test and 3 | ClassCastException: java.lang.String cannot be cast to java.lang.Boolean | |
java.lang.Integer | 0 and 0 | ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean | |
java.lang.Integer | 1 and 0 | ClassCastException: java.lang.Integer cannot be cast to java.lang.Boolean |