mariofusco commented on code in PR #5676:
URL: 
https://github.com/apache/incubator-kie-drools/pull/5676#discussion_r1481677805


##########
kie-dmn/kie-dmn-openapi/src/main/java/org/kie/dmn/openapi/impl/DMNOASGeneratorImpl.java:
##########
@@ -81,7 +82,8 @@ private void prepareSerializaton() {
         ObjectNode tree = JsonUtil.objectNode();
         ObjectNode definitions = JsonUtil.objectNode();
         tree.set("definitions", definitions);
-        for (Entry<DMNType, Schema> kv : schemas.entrySet()) {
+        final List<Entry<DMNType, Schema>> sortedEntries = 
schemas.entrySet().stream().sorted(Map.Entry.comparingByKey(Comparator.comparing(DMNType::getName))).toList();
+        for (Entry<DMNType, Schema> kv : sortedEntries) {

Review Comment:
   If I understand correctly the purpose of this change is traversing the 
`schemas` Map in a deterministic order. In this case wouldn't be easier and 
more readable to turn the `HashMap` into a `TreeMap`, something like:
   ```
   private final Map<DMNType, Schema> schemas = new 
TreeMap<>(Comparator.comparing(DMNType::getName));
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to