org.apache.tapestry5.func
Class Predicate<T>

java.lang.Object
  extended by org.apache.tapestry5.func.Predicate<T>

public abstract class Predicate<T>
extends java.lang.Object

Used when filtering a collection of objects of a given type; the predicate is passed each object in turn, and returns true to include the object in the result collection.

The F class includes a number of Predicate factory methods.

Since:
5.2.0
See Also:
Flow.filter(Predicate), Flow.remove(Predicate)

Constructor Summary
Predicate()
           
 
Method Summary
abstract  boolean accept(T object)
          This method is overridden in subclasses to define which objects the Predicate will accept and which it will reject.
 Predicate<T> and(Predicate<? super T> other)
          Combines this Predicate with another compatible Predicate to form a new Predicate, which is returned.
 Predicate<T> invert()
          Inverts this Predicate, returning a new Predicate that inverts the value returned from accept(T).
 Predicate<T> or(Predicate<? super T> other)
          Combines this Predicate with another compatible Predicate to form a new Predicate, which is returned.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Predicate

public Predicate()
Method Detail

accept

public abstract boolean accept(T object)
This method is overridden in subclasses to define which objects the Predicate will accept and which it will reject.


and

public final Predicate<T> and(Predicate<? super T> other)
Combines this Predicate with another compatible Predicate to form a new Predicate, which is returned. The new Predicate is true only if both of the combined Predicates are true.


or

public final Predicate<T> or(Predicate<? super T> other)
Combines this Predicate with another compatible Predicate to form a new Predicate, which is returned. The new Predicate is true if either of the combined Predicates are true.


invert

public final Predicate<T> invert()
Inverts this Predicate, returning a new Predicate that inverts the value returned from accept(T).



Copyright © 2010 Apache Software Foundation. All Rights Reserved.