amit-jain commented on code in PR #1135:
URL: https://github.com/apache/jackrabbit-oak/pull/1135#discussion_r1347067310


##########
oak-commons/src/main/java/org/apache/jackrabbit/oak/commons/sort/ExternalSort.java:
##########
@@ -460,11 +602,21 @@ public static <T> File sortAndSave(List<T> tmplist,
      * @param typeToString
      *        function to map string to custom type. User for coverting line 
to custom type for the
      *        purpose of sorting
+     * @param filterPredicate
+     *            predicate to filter out data which need to be sorted
      */
     public static <T> File sortAndSave(List<T> tmplist,
                                        Comparator<T> cmp, Charset cs, File 
tmpdirectory,
-                                       boolean distinct, Compression 
algorithm, Function<T, String> typeToString) throws IOException {
-        Collections.sort(tmplist, cmp);
+                                       boolean distinct, Compression algorithm,
+                                       Function<T, String> typeToString,
+                                       @Nullable Predicate<T> filterPredicate
+    ) throws IOException {
+        if ( filterPredicate == null){

Review Comment:
   null check is not a problem but the usage of the filter predicate is ` 
tmplist.removeIf(t -> filterPredicate.test(t));`. Also a change for 
simplification and clarity



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

Reply via email to