Stay organized with collections
Save and categorize content based on your preferences.
LongPredicate
@FunctionalInterface interface LongPredicate
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)
.
Summary
Public methods |
open LongPredicate! |
Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
|
open LongPredicate! |
Returns a predicate that represents the logical negation of this predicate.
|
open LongPredicate! |
Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
|
abstract Boolean |
Evaluates this predicate on the given argument.
|
Public methods
and
open fun and(other: LongPredicate!): LongPredicate!
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 |
LongPredicate!: a predicate that will be logically-ANDed with this predicate |
Return |
LongPredicate! |
a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate |
Exceptions |
java.lang.NullPointerException |
if other is null |
negate
open fun negate(): LongPredicate!
Returns a predicate that represents the logical negation of this predicate.
Return |
LongPredicate! |
a predicate that represents the logical negation of this predicate |
or
open fun or(other: LongPredicate!): LongPredicate!
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 |
LongPredicate!: a predicate that will be logically-ORed with this predicate |
Return |
LongPredicate! |
a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate |
Exceptions |
java.lang.NullPointerException |
if other is null |
test
abstract fun test(value: Long): Boolean
Evaluates this predicate on the given argument.
Parameters |
value |
Long: the input argument |
Return |
Boolean |
true if the input argument matches 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,["# LongPredicate\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nLongPredicate\n=============\n\n```\n@FunctionalInterface interface LongPredicate\n```\n\n|---------------------------------------|\n| [java.util.function.LongPredicate](#) |\n\nRepresents a predicate (boolean-valued function) of one `long`-valued argument. This is the `long`-consuming primitive type specialization of [Predicate](/reference/kotlin/java/util/function/Predicate).\n\nThis is a [functional interface](/reference/kotlin/java/util/function/package-summary) whose functional method is [test(long)](#test(kotlin.Long)).\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [LongPredicate](#)! | [and](#and(java.util.function.LongPredicate))`(`other:` `[LongPredicate](#)!`)` Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. |\n| open [LongPredicate](#)! | [negate](#negate())`()` Returns a predicate that represents the logical negation of this predicate. |\n| open [LongPredicate](#)! | [or](#or(java.util.function.LongPredicate))`(`other:` `[LongPredicate](#)!`)` Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. |\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [test](#test(kotlin.Long))`(`value:` `[Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)`)` Evaluates this predicate on the given argument. |\n\nPublic methods\n--------------\n\n### and\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun and(other: LongPredicate!): LongPredicate!\n```\n\nReturns 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.\n\nAny 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.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------|\n| `other` | [LongPredicate](#)!: a predicate that will be logically-ANDed with this predicate |\n\n| Return ||\n|---------------------|-------------------------------------------------------------------------------------------------------------------|\n| [LongPredicate](#)! | a composed predicate that represents the short-circuiting logical AND of this predicate and the `other` predicate |\n\n| Exceptions ||\n|----------------------------------|------------------|\n| `java.lang.NullPointerException` | if other is null |\n\n### negate\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun negate(): LongPredicate!\n```\n\nReturns a predicate that represents the logical negation of this predicate.\n\n| Return ||\n|---------------------|--------------------------------------------------------------------|\n| [LongPredicate](#)! | a predicate that represents the logical negation of this predicate |\n\n### or\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun or(other: LongPredicate!): LongPredicate!\n```\n\nReturns 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.\n\nAny 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.\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------|\n| `other` | [LongPredicate](#)!: a predicate that will be logically-ORed with this predicate |\n\n| Return ||\n|---------------------|------------------------------------------------------------------------------------------------------------------|\n| [LongPredicate](#)! | a composed predicate that represents the short-circuiting logical OR of this predicate and the `other` predicate |\n\n| Exceptions ||\n|----------------------------------|------------------|\n| `java.lang.NullPointerException` | if other is null |\n\n### test\n\nAdded in [API level 24](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun test(value: Long): Boolean\n```\n\nEvaluates this predicate on the given argument.\n\n| Parameters ||\n|---------|--------------------------------------------------------------------------------------------------|\n| `value` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): the input argument |\n\n| Return ||\n|------------------------------------------------------------------------------------|-----------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if the input argument matches the predicate, otherwise `false` |"]]