Matthias Pfau wrote:
this is my first post ever to a mailing list
Welcome

I just asked myself why the EqualsBuilder does not support the comparison of
Collections. Personally, I am very often in the situation that I have to
compare Collections. Collections are widely used and there might be other
people out there that need a proper support for this case. As you might know
the problem when just calling .equals(other) on an object is, that both
Collections need to have the same order. But two Collections should
definitely be equal if they contain the same elements, ordering is not
important!

This is a misunderstanding of the java collections framework.

The framework consists of three collections interfaces - Collection, Set and List.

Two List implementations are equal based on their order.
Two Set implementations are equal based on their content.
Two Collection implementations have no defined equals behaviour.

If you want to achieve equals comparison based on content without order, then simply create two HashSet objects instead of two ArrayList objects.

Stephen

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to