Stay organized with collections
Save and categorize content based on your preferences.
BiPredicate
public
interface
BiPredicate
java.util.function.BiPredicate<T, U>
|
Represents a predicate (boolean-valued function) of two arguments. This is
the two-arity specialization of Predicate
.
This is a functional interface
whose functional method is test(java.lang.Object, java.lang.Object)
.
Summary
Public methods |
default
BiPredicate<T, U>
|
and(BiPredicate<? super T, ? super U> other)
Returns a composed predicate that represents a short-circuiting logical
AND of this predicate and another.
|
default
BiPredicate<T, U>
|
negate()
Returns a predicate that represents the logical negation of this
predicate.
|
default
BiPredicate<T, U>
|
or(BiPredicate<? super T, ? super U> other)
Returns a composed predicate that represents a short-circuiting logical
OR of this predicate and another.
|
abstract
boolean
|
test(T t, U u)
Evaluates this predicate on the given arguments.
|
Public methods
and
public BiPredicate<T, U> and (BiPredicate<? super T, ? super U> other)
Returns a composed predicate that represents a short-circuiting logical
AND of this predicate and another. When evaluating the composed
predicate, if this predicate is false
, then the other
predicate is not evaluated.
Any exceptions thrown during evaluation of either predicate are relayed
to the caller; if evaluation of this predicate throws an exception, the
other
predicate will not be evaluated.
Parameters |
other |
BiPredicate : a predicate that will be logically-ANDed with this
predicate |
Returns |
BiPredicate<T, U> |
a composed predicate that represents the short-circuiting logical
AND of this predicate and the other predicate |
negate
public BiPredicate<T, U> negate ()
Returns a predicate that represents the logical negation of this
predicate.
Returns |
BiPredicate<T, U> |
a predicate that represents the logical negation of this
predicate |
or
public BiPredicate<T, U> or (BiPredicate<? super T, ? super U> other)
Returns a composed predicate that represents a short-circuiting logical
OR of this predicate and another. When evaluating the composed
predicate, if this predicate is true
, then the other
predicate is not evaluated.
Any exceptions thrown during evaluation of either predicate are relayed
to the caller; if evaluation of this predicate throws an exception, the
other
predicate will not be evaluated.
Parameters |
other |
BiPredicate : a predicate that will be logically-ORed with this
predicate |
Returns |
BiPredicate<T, U> |
a composed predicate that represents the short-circuiting logical
OR of this predicate and the other predicate |
test
public abstract boolean test (T t,
U u)
Evaluates this predicate on the given arguments.
Parameters |
t |
T : the first input argument |
u |
U : the second input argument |
Returns |
boolean |
true if the input arguments match the predicate,
otherwise false |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# BiPredicate\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nBiPredicate\n===========\n\n\n`\npublic\n\n\ninterface\nBiPredicate\n`\n\n\n`\n\n\n`\n\n|----------------------------------------|\n| java.util.function.BiPredicate\\\u003cT, U\\\u003e |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nRepresents a predicate (boolean-valued function) of two arguments. This is\nthe two-arity specialization of [Predicate](/reference/java/util/function/Predicate).\n\nThis is a [functional interface](/reference/java/util/function/package-summary)\nwhose functional method is [test(java.lang.Object, java.lang.Object)](/reference/java/util/function/BiPredicate#test(T,%20U)). \n**See also:**\n\n- [Predicate](/reference/java/util/function/Predicate)\n\nSummary\n-------\n\n| ### Public methods ||\n|-----------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` default `[BiPredicate](/reference/java/util/function/BiPredicate)`\u003cT, U\u003e` | ` `[and](/reference/java/util/function/BiPredicate#and(java.util.function.BiPredicate\u003c?%20super%20T,?%20super%20U\u003e))`(`[BiPredicate](/reference/java/util/function/BiPredicate)`\u003c? super T, ? super U\u003e other) ` Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. |\n| ` default `[BiPredicate](/reference/java/util/function/BiPredicate)`\u003cT, U\u003e` | ` `[negate](/reference/java/util/function/BiPredicate#negate())`() ` Returns a predicate that represents the logical negation of this predicate. |\n| ` default `[BiPredicate](/reference/java/util/function/BiPredicate)`\u003cT, U\u003e` | ` `[or](/reference/java/util/function/BiPredicate#or(java.util.function.BiPredicate\u003c?%20super%20T,?%20super%20U\u003e))`(`[BiPredicate](/reference/java/util/function/BiPredicate)`\u003c? super T, ? super U\u003e other) ` Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. |\n| ` abstract boolean` | ` `[test](/reference/java/util/function/BiPredicate#test(T,%20U))`(T t, U u) ` Evaluates this predicate on the given arguments. |\n\nPublic methods\n--------------\n\n### and\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic BiPredicate\u003cT, U\u003e and (BiPredicate\u003c? super T, ? super U\u003e other)\n```\n\nReturns a composed predicate that represents a short-circuiting logical\nAND of this predicate and another. When evaluating the composed\npredicate, if this predicate is `false`, then the `other`\npredicate is not evaluated.\n\nAny exceptions thrown during evaluation of either predicate are relayed\nto the caller; if evaluation of this predicate throws an exception, the\n`other` predicate will not be evaluated.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|------------------------------------------------------------------------------------|\n| `other` | `BiPredicate`: a predicate that will be logically-ANDed with this predicate \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------|\n| [BiPredicate](/reference/java/util/function/BiPredicate)`\u003cT, U\u003e` | a composed predicate that represents the short-circuiting logical AND of this predicate and the `other` predicate \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------|------------------|\n| [NullPointerException](/reference/java/lang/NullPointerException) | if other is null |\n\n### negate\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic BiPredicate\u003cT, U\u003e negate ()\n```\n\nReturns a predicate that represents the logical negation of this\npredicate.\n\n\u003cbr /\u003e\n\n| Returns ||\n|------------------------------------------------------------------|---------------------------------------------------------------------------|\n| [BiPredicate](/reference/java/util/function/BiPredicate)`\u003cT, U\u003e` | a predicate that represents the logical negation of this predicate \u003cbr /\u003e |\n\n### or\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic BiPredicate\u003cT, U\u003e or (BiPredicate\u003c? super T, ? super U\u003e other)\n```\n\nReturns a composed predicate that represents a short-circuiting logical\nOR of this predicate and another. When evaluating the composed\npredicate, if this predicate is `true`, then the `other`\npredicate is not evaluated.\n\nAny exceptions thrown during evaluation of either predicate are relayed\nto the caller; if evaluation of this predicate throws an exception, the\n`other` predicate will not be evaluated.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------|\n| `other` | `BiPredicate`: a predicate that will be logically-ORed with this predicate \u003cbr /\u003e |\n\n| Returns ||\n|------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|\n| [BiPredicate](/reference/java/util/function/BiPredicate)`\u003cT, U\u003e` | a composed predicate that represents the short-circuiting logical OR of this predicate and the `other` predicate \u003cbr /\u003e |\n\n| Throws ||\n|-------------------------------------------------------------------|------------------|\n| [NullPointerException](/reference/java/lang/NullPointerException) | if other is null |\n\n### test\n\nAdded in [API level 24](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract boolean test (T t, \n U u)\n```\n\nEvaluates this predicate on the given arguments.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-----|---------------------------------------|\n| `t` | `T`: the first input argument \u003cbr /\u003e |\n| `u` | `U`: the second input argument \u003cbr /\u003e |\n\n| Returns ||\n|-----------|-----------------------------------------------------------------------------|\n| `boolean` | `true` if the input arguments match the predicate, otherwise `false` \u003cbr /\u003e |"]]