I was reading up the Queue api docs. I could not quite understand the statement 'Queue implementations generally do not define element-based versions of methods equals and hashCode but instead inherit the identity based versions from class Object, because element-based equality is not always well-defined for queues with the same elements but different ordering properties.' Could anyone please elaborate preferably with an example.
I think what it's trying to say is that a Queue has no knowledge of what is really inside it (apart from that it's a Message), it's further complicated by the fact that you could have an 'identical' message (in terms of business data) but with different Meta-data (e.g. Priority), so the concept of a message being 'equal' is difficult for implementors to provide.