From 8fe2b4eed010b2ef1134c63cfd8a0eea0b2b75fc Mon Sep 17 00:00:00 2001 From: Henri Yandell Date: Tue, 15 Sep 2009 05:55:16 +0000 Subject: [PATCH] Merging from -r468106:814127 of collections_jdk5_branch - namely where this code was generified; mostly in r738956. Also see the following revisions: ------------------------------------------------------------------------ r641231 | skestle | 2008-03-26 02:58:51 -0700 (Wed, 26 Mar 2008) | 1 line Started incorporating Edwin's patch for COLLECTIONS-253, in preparation for COLLECTIONS-290. ------------------------------------------------------------------------ git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@815053 13f79535-47bb-0310-9956-ffa450edef68 --- .../collections/functors/TruePredicate.java | 25 ++++++++++++++----- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/java/org/apache/commons/collections/functors/TruePredicate.java b/src/java/org/apache/commons/collections/functors/TruePredicate.java index 029704896..fa6bd57de 100644 --- a/src/java/org/apache/commons/collections/functors/TruePredicate.java +++ b/src/java/org/apache/commons/collections/functors/TruePredicate.java @@ -27,14 +27,27 @@ import org.apache.commons.collections.Predicate; * @version $Revision$ $Date$ * * @author Stephen Colebourne + * @author Stephen Kestle */ -public final class TruePredicate implements Predicate, Serializable { +public final class TruePredicate implements Predicate, Serializable { /** Serial version UID */ private static final long serialVersionUID = 3374767158756189740L; /** Singleton predicate instance */ - public static final Predicate INSTANCE = new TruePredicate(); + public static final Predicate INSTANCE = new TruePredicate(); + + /** + * Factory returning the singleton instance. + * + * @return the singleton instance + * @since Commons Collections 3.1 + * @deprecated + */ + @Deprecated + public static Predicate getInstance() { + return truePredicate(); + } /** * Factory returning the singleton instance. @@ -42,8 +55,9 @@ public final class TruePredicate implements Predicate, Serializable { * @return the singleton instance * @since Commons Collections 3.1 */ - public static Predicate getInstance() { - return INSTANCE; + @SuppressWarnings("unchecked") + public static Predicate truePredicate() { + return (Predicate) INSTANCE; } /** @@ -59,8 +73,7 @@ public final class TruePredicate implements Predicate, Serializable { * @param object the input object * @return true always */ - public boolean evaluate(Object object) { + public boolean evaluate(T object) { return true; } - }