Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  * Copyright (C) 2007 The Guava Authors
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * See the License for the specific language governing permissions and
 * limitations under the License.
import  javax.annotation.Nullable;

Determines a true or false value for a given input.

The Predicates class provides common predicates and related utilities.

See the Guava User Guide article on the use of Predicate.

Kevin Bourrillion
2.0 (imported from Google Collections Library)
public interface Predicate<T> {
Returns the result of applying this predicate to input. This method is generally expected, but not absolutely required, to have the following properties:
  • Its execution does not cause any observable side effects.
  • The computation is consistent with equals; that is, Objects.equal(a, b) implies that predicate.apply(a) == predicate.apply(b)).

NullPointerException if input is null and this predicate does not accept null arguments
  boolean apply(@Nullable T input);

Indicates whether another object is equal to this predicate.

Most implementations will have no reason to override the behavior of Object.equals. However, an implementation may also choose to return true whenever object is a Predicate that it considers interchangeable with this one. "Interchangeable" typically means that this.apply(t) == that.apply(t) for all t of type T). Note that a false result from this method does not imply that the predicates are known not to be interchangeable.

  boolean equals(@Nullable Object object);
New to GrepCode? Check out our FAQ X