On 04/11/2014 05:52 AM, Dipanjan Laha wrote:
> Hi,
> 
> The only issue here is then Collection's equals implementation would need
> to check individually whether the Collection also implements List, Set or
> Bag (more such interfaces may come up in the future). This is kind of a
> hard coupling between Collections equals and other implementations which
> will become very difficult to maintain. The other option would be to fall
> back to Object#equals (a lot of Java collection classes do that), but that
> would mean that value based comparison won't be possible. Maybe there's a
> better way to solve this, but I can't think of anything right now.

usually the decorators delegate the call to equals to the decorated
collection, which means we can not guarantee the symmetry requirement
for all possible decorated collections.

The only way to be on the safe-side would be to delegate to Object#equals().

A user can and should use CollectionUtils#isEqualCollection() for a full
value-based equality check imho.

Thomas

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

Reply via email to