# Predicate

public interface **Predicate** Represents a predicate (boolean-valued function) of one argument.

This is a [functional interface](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/package-summary)
whose functional method is `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html#test(T)`.

### Public Method Summary

|---|---|
| [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\> | [and](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html#and(java.util.function.Predicate<?%20super%20T>))([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> other) Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another. |
| static \<T\> [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\> | [isEqual](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html#isEqual(java.lang.Object))([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) targetRef) Returns a predicate that tests if two arguments are equal according to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Objects.html#equals(java.lang.Object,%20java.lang.Object)`. |
| [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\> | [negate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html#negate())() Returns a predicate that represents the logical negation of this predicate. |
| [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\> | [or](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html#or(java.util.function.Predicate<?%20super%20T>))([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> other) Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another. |
| abstract boolean | [test](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html#test(T))(T t) Evaluates this predicate on the given argument. |

## Public Methods

#### public [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\>
**and**
([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> 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 | 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

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if other is null |
|---|---|

#### public static [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\>
**isEqual**
([Object](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/Object.html) targetRef)

Returns a predicate that tests if two arguments are equal according
to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Objects.html#equals(java.lang.Object,%20java.lang.Object)`.

##### Parameters

| targetRef | the object reference with which to compare for equality, which may be `null` |
|---|---|

##### Returns

- a predicate that tests if two arguments are equal according to `https://developers.google.com/j2objc/javadoc/jre/reference/java/util/Objects.html#equals(java.lang.Object,%20java.lang.Object)`

#### public [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\>
**negate**
()

Returns a predicate that represents the logical negation of this
predicate.

##### Returns

- a predicate that represents the logical negation of this predicate

#### public [Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<T\>
**or**
([Predicate](https://developers.google.com/j2objc/javadoc/jre/reference/java/util/function/Predicate.html)\<? super T\> 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 | 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

##### Throws

| [NullPointerException](https://developers.google.com/j2objc/javadoc/jre/reference/java/lang/NullPointerException.html) | if other is null |
|---|---|

#### public abstract boolean
**test**
(T t)

Evaluates this predicate on the given argument.

##### Parameters

| t | the input argument |
|---|---|

##### Returns

- `true` if the input argument matches the predicate, otherwise `false`