powsybl-core icon indicating copy to clipboard operation
powsybl-core copied to clipboard

Fix random ordering in index identifables and in extendable extensions

Open flo-dup opened this issue 1 year ago • 0 comments

Please check if the PR fulfills these requirements

  • [x] The commit message follows our guidelines
  • [ ] Tests for the changes have been added (for bug fixes / features)
  • [ ] Docs have been added / updated (for bug fixes / features)

Does this PR already have an issue describing the problem? No

What kind of change does this PR introduce? Bug fix

What is the current behavior? Two collections returned are in random order:

  • NetworkIndex::getIdentifiables are values of a HashMap
  • AbstractExtendable::getExtensions are values of a HashMap

Leading to unwanted behaviour:

  • Random order when writing extensions and corresponding namespaces
  • Random order of all equipments when merging two networks
  • Random order when validating equipments (thrown exception might vary from one run to the other)

What is the new behavior (if this is a feature change)? The corresponding HashMaps are replaced by LinkedHashMaps

Does this PR introduce a breaking change or deprecate an API?

  • [ ] Yes
  • [x] No

flo-dup avatar Nov 27 '23 14:11 flo-dup