@@ -71,20 +71,18 @@ public static <T> Map<String, List<T>> partitionByChildren(
71
71
String currentInputName = pathFunction .apply (currentInput );
72
72
assert currentInputName .startsWith (scope );
73
73
74
- // Find all the inputs that sort before the first child, and add them to the current scope entry
75
- while (currentInputName .compareTo (currentChild ) < 0 ) {
76
- output .get (scope ).add (currentInput );
77
- if (inputIterator .hasNext () == false ) {
78
- return output ;
79
- }
80
- currentInput = inputIterator .next ();
81
- currentInputName = pathFunction .apply (currentInput );
82
- assert currentInputName .startsWith (scope );
83
- }
84
-
85
74
// Iterate through all the children
86
75
while (currentChild != null ) {
87
- if (currentInputName .startsWith (currentChild + "." )) {
76
+ if (currentInputName .compareTo (currentChild ) < 0 ) {
77
+ // If we sort before the current child, then we sit in the parent scope
78
+ output .get (scope ).add (currentInput );
79
+ if (inputIterator .hasNext () == false ) {
80
+ return output ;
81
+ }
82
+ currentInput = inputIterator .next ();
83
+ currentInputName = pathFunction .apply (currentInput );
84
+ assert currentInputName .startsWith (scope );
85
+ } else if (currentInputName .startsWith (currentChild + "." )) {
88
86
// If this input sits under the current child, add it to that child scope
89
87
// and then get the next input
90
88
output .get (currentChild ).add (currentInput );
0 commit comments