You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ba...@apache.org on 2009/09/15 07:55:13 UTC

svn commit: r815050 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NullPredicate.java

Author: bayard
Date: Tue Sep 15 05:55:13 2009
New Revision: 815050

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

    ------------------------------------------------------------------------
    r643795 | skestle | 2008-04-02 01:49:57 -0700 (Wed, 02 Apr 2008) | 5 lines
    
    Generified EqualPredicate and created individual test class moved from TestPredicateUtils
    
    Added assertFalse() and assertTrue to BasicPredicateTestBase with (Predicate, Object) parameters
    
    Issues: COLLECTIONS-243, COLLECTIONS-253, COLLECTIONS-293
    ------------------------------------------------------------------------
    r643782 | skestle | 2008-04-02 01:00:00 -0700 (Wed, 02 Apr 2008) | 5 lines
    
    Generified NullPredicate and created individual test class moved on TestPredicateUtils
    
    Renamed PredicateTestBase to MockPredicateTestBase to reduce confusion and added BasicPredicateTestBase.
    
    Issues: COLLECTIONS-243, COLLECTIONS-253, COLLECTIONS-293
    ------------------------------------------------------------------------

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

Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NullPredicate.java
URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NullPredicate.java?rev=815050&r1=815049&r2=815050&view=diff
==============================================================================
--- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NullPredicate.java (original)
+++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NullPredicate.java Tue Sep 15 05:55:13 2009
@@ -28,22 +28,35 @@
  *
  * @author Stephen Colebourne
  */
-public final class NullPredicate implements Predicate, Serializable {
+public final class NullPredicate<T> implements Predicate<T>, Serializable {
 
     /** Serial version UID */
     private static final long serialVersionUID = 7533784454832764388L;
     
     /** Singleton predicate instance */
-    public static final Predicate INSTANCE = new NullPredicate();
+    public static final Predicate<?> INSTANCE = new NullPredicate<Object>();
 
     /**
      * Factory returning the singleton instance.
      * 
      * @return the singleton instance
      * @since Commons Collections 3.1
+     * @deprecated use {@link #nullPredicate()} instead.
      */
-    public static Predicate getInstance() {
-        return INSTANCE;
+    @Deprecated
+    public static <T> Predicate<T> getInstance() {
+        return nullPredicate();
+    }
+
+    /**
+     * Factory returning the singleton instance.
+     * 
+     * @return the singleton instance
+     * @since Commons Collections 3.1
+     */
+    @SuppressWarnings("unchecked")
+    public static <T> Predicate<T> nullPredicate() {
+        return (Predicate<T>) INSTANCE;
     }
 
     /**