commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: svn commit: r825151 - /commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NOPClosure.java
Date Wed, 14 Oct 2009 17:56:29 GMT
On 14/10/2009, mbenson@apache.org <mbenson@apache.org> wrote:
> Author: mbenson
>  Date: Wed Oct 14 14:23:13 2009
>  New Revision: 825151
>
>  URL: http://svn.apache.org/viewvc?rev=825151&view=rev
>  Log:
>  [COLLECTIONS-341]
>
>  Modified:
>     commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NOPClosure.java
>
>  Modified: commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NOPClosure.java
>  URL: http://svn.apache.org/viewvc/commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NOPClosure.java?rev=825151&r1=825150&r2=825151&view=diff
>  ==============================================================================
>  --- commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NOPClosure.java
(original)
>  +++ commons/proper/collections/trunk/src/java/org/apache/commons/collections/functors/NOPClosure.java
Wed Oct 14 14:23:13 2009
>  @@ -28,7 +28,7 @@
>   *
>   * @author Stephen Colebourne
>   */
>  -public class NOPClosure<E> implements Closure<E>, Serializable {
>  +public final class NOPClosure<E> implements Closure<E>, Serializable {
>
>      /** Serial version UID */
>      private static final long serialVersionUID = 3518477308466486130L;
>  @@ -68,13 +68,7 @@
>       */
>      @Override
>      public boolean equals(Object arg0) {
>  -        if (arg0 == this) {
>  -            return true;
>  -        }
>  -        if (arg0 instanceof NOPClosure == false) {
>  -            return false;
>  -        }
>  -        return arg0.hashCode() == this.hashCode();
>  +        return arg0 == this || arg0 instanceof NOPClosure<?>;
>      }

Why not just remove the equals() and hashCode() methods?
The defaults are just as good.

>      /**
>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message