zjffdu commented on a change in pull request #4075:
URL: https://github.com/apache/zeppelin/pull/4075#discussion_r592079846



##########
File path: 
zeppelin-zengine/src/main/java/org/apache/zeppelin/interpreter/InterpreterSetting.java
##########
@@ -587,19 +587,13 @@ public void sortPropertiesByTemplate(Object 
propertiesInTemplate) {
           int i1 = sortedKeys.indexOf(o1);
           int i2 = sortedKeys.indexOf(o2);
           if (i1 != -1 && i2 != -1) {
-            if (i1 < i2) {
-              return -1;
-            } else if (i1 > i2) {
-              return 1;
-            } else {
-              return 0;
-            }
+            // If both are present in the template, use natural order of 
indexes
+            return (i1 - i2);
           } else {
-            if (i1 == -1) {
-              return 1;
-            } else {
-              return -1;
-            }
+            // If one, or both are not in the template, use reverse order, so 
that missing
+           // elements are placedare at the end

Review comment:
       One minor indentation issue. 




----------------------------------------------------------------
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.

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


Reply via email to