On Wed, Oct 14, 2009 at 19:56, sebb <seb...@gmail.com> wrote: > Why not just remove the equals() and hashCode() methods? > The defaults are just as good.
It is not the same because multiple instances of NOPClosure can exist. This is because of serialization support. By implementing readResolve() method which will always return INSTANCE static member will ensure that no more then one instance of NOPClosure exists at any given time. With this guaranty default equals() and hashCode() will do their job as they should. Javadoc comment on INSTANCE static member, which says "Singleton predicate instance", is not correct because class doesn't implement singleton pattern correctly. This would be fixed by implementing readResolve() as previously described. I have created a patch for this, it is in jira[1], so can someone review it? [1] https://issues.apache.org/jira/browse/COLLECTIONS-343 --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org