Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 21674 invoked from network); 15 Sep 2009 05:55:56 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 15 Sep 2009 05:55:56 -0000 Received: (qmail 8994 invoked by uid 500); 15 Sep 2009 05:55:56 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 8913 invoked by uid 500); 15 Sep 2009 05:55:56 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 8904 invoked by uid 99); 15 Sep 2009 05:55:56 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Sep 2009 05:55:56 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 15 Sep 2009 05:55:52 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id E06D32388A39; Tue, 15 Sep 2009 05:55:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r815046 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/EqualPredicate.java Date: Tue, 15 Sep 2009 05:55:02 -0000 To: commits@commons.apache.org From: bayard@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20090915055502.E06D32388A39@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: bayard Date: Tue Sep 15 05:55:02 2009 New Revision: 815046 URL: http://svn.apache.org/viewvc?rev=815046&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 ------------------------------------------------------------------------ Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/EqualPredicate.java Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/EqualPredicate.java URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/EqualPredicate.java?rev=815046&r1=815045&r2=815046&view=diff ============================================================================== --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/EqualPredicate.java (original) +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/EqualPredicate.java Tue Sep 15 05:55:02 2009 @@ -16,6 +16,8 @@ */ package org.apache.commons.collections.functors; +import static org.apache.commons.collections.functors.NullPredicate.nullPredicate; + import java.io.Serializable; import org.apache.commons.collections.Predicate; @@ -29,7 +31,7 @@ * * @author Stephen Colebourne */ -public final class EqualPredicate implements Predicate, Serializable { +public final class EqualPredicate implements Predicate, Serializable { /** Serial version UID */ private static final long serialVersionUID = 5633766978029907089L; @@ -43,12 +45,28 @@ * @param object the object to compare to * @return the predicate * @throws IllegalArgumentException if the predicate is null + * @deprecated use {@link #equalPredicate(Object)} instead. + */ + @Deprecated + public static Predicate getInstance(T object) { + if (object == null) { + return nullPredicate(); + } + return new EqualPredicate(object); + } + + /** + * Factory to create the identity predicate. + * + * @param object the object to compare to + * @return the predicate + * @throws IllegalArgumentException if the predicate is null */ - public static Predicate getInstance(Object object) { + public static Predicate equalPredicate(T object) { if (object == null) { - return NullPredicate.INSTANCE; + return nullPredicate(); } - return new EqualPredicate(object); + return new EqualPredicate(object); } /**