commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bay...@apache.org
Subject svn commit: r815053 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/TruePredicate.java
Date Tue, 15 Sep 2009 05:55:16 GMT
Author: bayard
Date: Tue Sep 15 05:55:16 2009
New Revision: 815053

URL: http://svn.apache.org/viewvc?rev=815053&view=rev
Log:
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.
    ------------------------------------------------------------------------

Modified:
    commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/TruePredicate.java

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/TruePredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/TruePredicate.java?rev=815053&r1=815052&r2=815053&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/TruePredicate.java
(original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/TruePredicate.java
Tue Sep 15 05:55:16 2009
@@ -27,23 +27,37 @@
  * @version $Revision$ $Date$
  *
  * @author Stephen Colebourne
+ * @author Stephen Kestle
  */
-public final class TruePredicate implements Predicate, Serializable {
+public final class TruePredicate<T> implements Predicate<T>, 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<Object>();
 
     /**
      * Factory returning the singleton instance.
      * 
      * @return the singleton instance
      * @since Commons Collections 3.1
+     * @deprecated
      */
-    public static Predicate getInstance() {
-        return INSTANCE;
+    @Deprecated 
+    public static <T> Predicate<T> getInstance() {
+        return truePredicate();
+    }
+
+    /**
+     * Factory returning the singleton instance.
+     * 
+     * @return the singleton instance
+     * @since Commons Collections 3.1
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> truePredicate() {
+        return (Predicate<T>) INSTANCE;
     }
 
     /**
@@ -59,8 +73,7 @@
      * @param object  the input object
      * @return true always
      */
-    public boolean evaluate(Object object) {
+    public boolean evaluate(T object) {
         return true;
     }
-
 }



Mime
View raw message