diff --git a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java index a22d3585c..67afcb946 100644 --- a/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java +++ b/spring-batch-infrastructure/src/main/java/org/springframework/batch/item/file/transform/RangeArrayPropertyEditor.java @@ -21,6 +21,7 @@ import org.springframework.util.StringUtils; import java.beans.PropertyEditorSupport; import java.util.Arrays; +import java.util.Comparator; /** * Property editor implementation which parses string and creates array of ranges. Ranges @@ -119,7 +120,7 @@ public class RangeArrayPropertyEditor extends PropertyEditorSupport { } // sort array of Ranges - Arrays.sort(c, (r1, r2) -> ranges[r1].getMin() - ranges[r2].getMin()); + Arrays.sort(c, Comparator.comparingInt(r -> ranges[r].getMin())); // set max values for all unbound ranges (except last range) for (int i = 0; i < c.length - 1; i++) {