1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package net.sf.collections15.functors.predicate;
17
18 import net.sf.collections15.Predicate;
19
20 import java.io.Serializable;
21
22
23 /***
24 * <code>Predicate</code> implementation that always evaluates to
25 * <code>true</code>.
26 *
27 * @author Stephen Colebourne
28 * @author Chris Lambrou (port to Java 5.0)
29 * @since Collections15 1.0
30 */
31 public final class TruePredicate <E> implements Predicate<E>, Serializable
32 {
33
34 static final long serialVersionUID = 8274221249111691049L;
35
36 /***
37 * ReturnsFactory returning the singleton instance.
38 *
39 * @return the singleton instance
40 *
41 * @since Commons Collections 3.1
42 */
43 public static <T> Predicate<T> getInstance()
44 {
45 return new TruePredicate<T>();
46 }
47
48 /***
49 * Creates a new instance.
50 */
51 protected TruePredicate()
52 {
53 }
54
55 /***
56 * Evaluates the <code>Predicate</code>, always returning
57 * <code>true</code>.
58 *
59 * @param object The input object.
60 *
61 * @return Always returns <code>true</code>.
62 */
63 public boolean evaluate(E object)
64 {
65 return true;
66 }
67
68 }