PageParameters.hashCode is inconsistent with equals for named parameters in a different order
PageParameters.equals and PageParameters.hashCode disagree about the named parameters, so two PageParameters that are equal can have different hash codes. That breaks the contract of Object.hashCode.
equals compares the named parameters regardless of their order: the lists must hold the same pairs, each the same number of times. hashCode uses namedParameters.hashCode(), the order-sensitive hash of the List<NamedPair>.
PageParameters a = new PageParameters().add("a", "1").add("b", "2");
PageParameters b = new PageParameters().add("b", "2").add("a", "1");
a.equals(b); // true
a.hashCode() == b.hashCode(); // false
Anything that puts PageParameters in a hash-based collection, or in a key that includes them, can treat these two as different. The fix is to make hashCode order-insensitive for the named parameters, for example by summing the hash codes of the pairs.
I’ll implement the fix for PageParameters.hashCode() and add regression tests for reordered named parameters and duplicate pairs. I’ll submit a PR once the fix is tested.
Go ahead! I hadn't instructed my agent to tackle this, so it's yours. 👍