LongPredicate
Stay organized with collections
Save and categorize content based on your preferences.
Represents a predicate (boolean-valued function) of one long
-valued
argument. This is the long
-consuming primitive type specialization of
Predicate
.
This is a functional interface
whose functional method is test(long)
.
Public Method Summary
LongPredicate
|
and( LongPredicate other)
Returns a composed predicate that represents a short-circuiting logical
AND of this predicate and another.
|
LongPredicate
|
negate()
Returns a predicate that represents the logical negation of this
predicate.
|
LongPredicate
|
or( LongPredicate other)
Returns a composed predicate that represents a short-circuiting logical
OR of this predicate and another.
|
abstract
boolean
|
test(long value)
Evaluates this predicate on the given argument.
|
Public Methods
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 |
a predicate that will be logically-ANDed with this
predicate |
Returns
- a composed predicate that represents the short-circuiting logical
AND of this predicate and the
other
predicate
Returns a predicate that represents the logical negation of this
predicate.
Returns
- a predicate that represents the logical negation of this
predicate
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 |
a predicate that will be logically-ORed with this
predicate |
Returns
- a composed predicate that represents the short-circuiting logical
OR of this predicate and the
other
predicate
public
abstract
boolean
test
(long value)
Evaluates this predicate on the given argument.
Returns
true
if the input argument matches the predicate,
otherwise false
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-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 2024-07-10 UTC."],[[["\u003cp\u003e\u003ccode\u003eLongPredicate\u003c/code\u003e is a functional interface representing a boolean-valued function that accepts a single \u003ccode\u003elong\u003c/code\u003e argument.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to test the predicate against a \u003ccode\u003elong\u003c/code\u003e value (\u003ccode\u003etest\u003c/code\u003e), and to combine predicates using logical AND (\u003ccode\u003eand\u003c/code\u003e), OR (\u003ccode\u003eor\u003c/code\u003e), and negation (\u003ccode\u003enegate\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThese methods allow for creating complex logical conditions by chaining and combining simple predicates.\u003c/p\u003e\n"],["\u003cp\u003eThe methods \u003ccode\u003eand\u003c/code\u003e and \u003ccode\u003eor\u003c/code\u003e are short-circuiting, meaning they may not evaluate the second predicate if the result can be determined from the first.\u003c/p\u003e\n"]]],["`LongPredicate` is a functional interface for a boolean-valued function accepting a `long` argument. Key actions include: `test(long)`, which evaluates the predicate on a given `long` value; `and(LongPredicate other)`, which combines this predicate with another using a short-circuiting logical AND; `negate()`, which returns the logical negation of this predicate; and `or(LongPredicate other)`, which combines with another using a short-circuiting logical OR. `NullPointerException` is thrown if the other predicate is null.\n"],null,["# LongPredicate\n\npublic interface **LongPredicate** \nRepresents a predicate (boolean-valued function) of one `long`-valued\nargument. This is the `long`-consuming primitive type specialization of\n[Predicate](../../../../reference/java/util/function/Predicate.html).\n\nThis is a [functional interface](/j2objc/javadoc/jre/reference/java/util/function/package-summary)\nwhose functional method is [test(long)](../../../../reference/java/util/function/LongPredicate.html#test(long)). \n\n##### See Also\n\n- [Predicate](../../../../reference/java/util/function/Predicate.html) \n\n### Public Method Summary\n\n|------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [LongPredicate](../../../../reference/java/util/function/LongPredicate.html) | [and](../../../../reference/java/util/function/LongPredicate.html#and(java.util.function.LongPredicate))([LongPredicate](../../../../reference/java/util/function/LongPredicate.html) other) Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. |\n| [LongPredicate](../../../../reference/java/util/function/LongPredicate.html) | [negate](../../../../reference/java/util/function/LongPredicate.html#negate())() Returns a predicate that represents the logical negation of this predicate. |\n| [LongPredicate](../../../../reference/java/util/function/LongPredicate.html) | [or](../../../../reference/java/util/function/LongPredicate.html#or(java.util.function.LongPredicate))([LongPredicate](../../../../reference/java/util/function/LongPredicate.html) 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/LongPredicate.html#test(long))(long value) Evaluates this predicate on the given argument. |\n\nPublic Methods\n--------------\n\n#### public [LongPredicate](../../../../reference/java/util/function/LongPredicate.html)\n**and**\n([LongPredicate](../../../../reference/java/util/function/LongPredicate.html) other)\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##### Parameters\n\n| other | a predicate that will be logically-ANDed with this predicate |\n|-------|--------------------------------------------------------------|\n\n##### Returns\n\n- a composed predicate that represents the short-circuiting logical AND of this predicate and the `other` predicate \n\n##### Throws\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if other is null |\n|-----------------------------------------------------------------------------------|------------------|\n\n#### public [LongPredicate](../../../../reference/java/util/function/LongPredicate.html)\n**negate**\n()\n\nReturns a predicate that represents the logical negation of this\npredicate. \n\n##### Returns\n\n- a predicate that represents the logical negation of this predicate \n\n#### public [LongPredicate](../../../../reference/java/util/function/LongPredicate.html)\n**or**\n([LongPredicate](../../../../reference/java/util/function/LongPredicate.html) other)\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##### Parameters\n\n| other | a predicate that will be logically-ORed with this predicate |\n|-------|-------------------------------------------------------------|\n\n##### Returns\n\n- a composed predicate that represents the short-circuiting logical OR of this predicate and the `other` predicate \n\n##### Throws\n\n| [NullPointerException](../../../../reference/java/lang/NullPointerException.html) | if other is null |\n|-----------------------------------------------------------------------------------|------------------|\n\n#### public abstract boolean\n**test**\n(long value)\n\nEvaluates this predicate on the given argument. \n\n##### Parameters\n\n| value | the input argument |\n|-------|--------------------|\n\n##### Returns\n\n- `true` if the input argument matches the predicate, otherwise `false`"]]