Wiki Markup |
---|
Keys of ordered sets and maps should typically be immutable. If this is not possible, ensure that the {{equals()}} and {{compareTo()}} methods do not take into account the mutable state while comparing objects. Failure to do this, for example, can produce inconsistent orderings in collections, for example. The documentation of {{java.util.Interface Set<E>}} and {{java.util.Interface Map<K,V>}} warn against this \[[API 2006|AA. Java References#API 06]\]: |
...
Failure to ensure that the keys used in a comparison operation are immutable can lead to non-deterministic behavior.
Rule Guideline | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
OBJ15-J | low | probable | high | P2 | L3 |
...