Sort values alphabetically in the xml
authorVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Thu, 14 Dec 2017 18:06:19 +0000 (21:06 +0300)
committerVitaliy.Bibaev <vitaliy.bibaev@jetbrains.com>
Thu, 14 Dec 2017 18:07:04 +0000 (21:07 +0300)
plugins/stats-collector/src/com/intellij/stats/personalization/impl/UserFactorStorageBase.kt

index 37730095282bde4e3410940d7cf02c4a3f37ea83..44a5e6b2445f8335ee3ebcf59e9b51e15b528be6 100644 (file)
@@ -50,7 +50,7 @@ abstract class UserFactorStorageBase
         }
 
         fun writeState(element: Element) {
-            for ((id, factor) in aggregateFactors) {
+            for ((id, factor) in aggregateFactors.asSequence().sortedBy { it.key }) {
                 val factorElement = Element("factor")
                 factorElement.attribute("id", id)
                 factor.writeState(factorElement)
@@ -151,7 +151,7 @@ abstract class UserFactorStorageBase
         }
 
         fun writeState(element: Element) {
-            for ((key, value) in data) {
+            for ((key, value) in data.asSequence().sortedBy { it.key }) {
                 val observation = Element("observation")
                 observation.attribute("name", key)
                 observation.attribute("value", value.toString())