Closed kwin closed 1 year ago
The iteration order is controlled by the entry set iterator provided to AbstractMap
and that order is derived from various things such as relative component priority and registration order. It's not necessary to extend a concrete implementation such as LinkedHashMap
.
Can you provide an example or test case demonstrating the issue you're seeing?
Sorry, my bad. In https://github.com/apache/maven-scm/blob/b04525fa0716e6de7a65bf9970284efa0e49b177/maven-scm-api/src/main/java/org/apache/maven/scm/manager/AbstractScmManager.java#L82 the subsequent entries incorrectly overwrite former entries with the same key. EntryMapAdapter is behaving correctly here.
As the
EntryMapAdapter
extends fromAbstractMap
its iteration order is non-predictable. In order to keep the order from the underlyingIterable
it should rather extend fromLinkedHashMap
.