Make tiles sorting deterministic in all cases

This may fix issue #5916.

In any case, it's wanted because this kind of sort is "unstable".
According to the docs:

    "This implementation performs an unstable sort; that is, if two
    elements are equal, their order might not be preserved."
Ok.  I didn't think to ask about the hash code, but that explanation would go well in a comment in the code.