[ofbiz-framework] branch trunk updated: Improved: Replace Collection.sort() with List.sort().(OFBIZ-11830)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Improved: Replace Collection.sort() with List.sort().(OFBIZ-11830)

Pawan Verma-2
This is an automated email from the ASF dual-hosted git repository.

pawan pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 3da16a1  Improved: Replace Collection.sort() with List.sort().(OFBIZ-11830)
3da16a1 is described below

commit 3da16a182c09a859a680c5c8846867d2a351a510
Author: Pawan Verma <[hidden email]>
AuthorDate: Sun Jun 28 01:21:23 2020 +0530

    Improved: Replace Collection.sort() with List.sort().(OFBIZ-11830)
---
 .../org/apache/ofbiz/accounting/payment/BillingAccountWorker.java   | 2 +-
 .../main/java/org/apache/ofbiz/content/ContentManagementWorker.java | 2 +-
 .../main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java   | 2 +-
 .../main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java | 6 +++---
 .../ofbiz/order/shoppingcart/product/ProductDisplayWorker.java      | 2 +-
 .../apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java | 2 +-
 .../base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java     | 2 +-
 .../java/org/apache/ofbiz/common/authentication/AuthHelper.java     | 2 +-
 .../src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java    | 2 +-
 .../main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java    | 2 +-
 .../src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java      | 2 +-
 .../java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java  | 2 +-
 .../main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java | 4 ++--
 13 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
index 475f827..8ecd930 100644
--- a/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
+++ b/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/BillingAccountWorker.java
@@ -98,7 +98,7 @@ public final class BillingAccountWorker {
                     billingAccountList.add(billingAccount);
                 }
             }
-            Collections.sort(billingAccountList, new BillingAccountComparator());
+            billingAccountList.sort(new BillingAccountComparator());
         }
         return billingAccountList;
     }
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java
index cb0705e..8456db8 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementWorker.java
@@ -132,7 +132,7 @@ public final class ContentManagementWorker {
         StringBuilder sig = new StringBuilder("");
         Collection<String> keyColl = pk.getPrimaryKey().getAllKeys();
         List<String> keyList = UtilMisc.makeListWritable(keyColl);
-        Collections.sort(keyList);
+        keyList.sort(null);
         for (String ky : keyList) {
             String val = (String)pk.get(ky);
             if (UtilValidate.isNotEmpty(val)) {
diff --git a/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java b/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
index 3bb61c5..6aea602 100644
--- a/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
+++ b/applications/content/src/main/java/org/apache/ofbiz/content/cms/ContentJsonEvents.java
@@ -66,7 +66,7 @@ public class ContentJsonEvents {
             nodes.add(getTreeNode(assoc));
         }
 
-        Collections.sort(nodes, (node1, node2) -> {
+        nodes.sort((node1, node2) -> {
             Map<String, Object> data1 = UtilGenerics.cast(node1.get("data"));
             Map<String, Object> data2 = UtilGenerics.cast(node2.get("data"));
             if (data1 == null || data2 == null) {
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
index 61e2f97..4e2d3d4 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
@@ -4186,7 +4186,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
 
     public List<ShoppingCartItem> getLineListOrderedByBasePrice(boolean ascending) {
         List<ShoppingCartItem> result = new ArrayList<>(this.cartLines);
-        Collections.sort(result, new BasePriceOrderComparator(ascending));
+        result.sort(new BasePriceOrderComparator(ascending));
         return result;
     }
 
@@ -4777,7 +4777,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
             }
             Timestamp estimatedShipDate = null;
             if (estimatedShipDates.size() > 0) {
-                Collections.sort(estimatedShipDates);
+                estimatedShipDates.sort(null);
                 estimatedShipDate  = estimatedShipDates.getLast();
                 shipGroup.set("estimatedShipDate", estimatedShipDate);
             }
@@ -4792,7 +4792,7 @@ public class ShoppingCart implements Iterable<ShoppingCartItem>, Serializable {
             }
             Timestamp estimatedDeliveryDate = null;
             if (UtilValidate.isNotEmpty(estimatedDeliveryDates)) {
-                Collections.sort(estimatedDeliveryDates);
+                estimatedDeliveryDates.sort(null);
                 estimatedDeliveryDate = estimatedDeliveryDates.getLast();
             } else {
 
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
index 5aa147e..d4cbb40 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java
@@ -307,7 +307,7 @@ public final class ProductDisplayWorker {
         }
 
         List<GenericValue> result = new LinkedList<>(values);
-        Collections.sort(result, new ProductByMapComparator(orderByMap, descending));
+        result.sort(new ProductByMapComparator(orderByMap, descending));
         return result;
     }
 
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
index fac31c0..245e5cf 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/product/ProductPromoWorker.java
@@ -334,7 +334,7 @@ public final class ProductPromoWorker {
                 ProductPromoUseInfo promoUse = promoUses.next();
                 sortedPromoUses.add(promoUse);
             }
-            Collections.sort(sortedPromoUses);
+            sortedPromoUses.sort(null);
             List<GenericValue> sortedExplodedProductPromoList = new ArrayList<>(sortedPromoUses.size());
             Map<String, Long> usesPerPromo = new HashMap<>();
             int indexOfFirstOrderTotalPromo = -1;
diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
index 3b64e3e..948e1dd 100644
--- a/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
+++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java
@@ -209,7 +209,7 @@ public final class UtilMisc {
         toSort.addAll(listOfMaps);
         try {
             MapComparator mc = new MapComparator(sortKeys);
-            Collections.sort(toSort, mc);
+            toSort.sort(mc);
         } catch (Exception e) {
             Debug.logError(e, "Problems sorting list of maps; returning null.", MODULE);
             return null;
diff --git a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java
index c5107b7..5c968fe 100644
--- a/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java
+++ b/framework/common/src/main/java/org/apache/ofbiz/common/authentication/AuthHelper.java
@@ -119,7 +119,7 @@ public final class AuthHelper {
                 }
             }
 
-            Collections.sort(authenticators, new AuthenticationComparator());
+            authenticators.sort(new AuthenticationComparator());
             authenticatorsLoaded = true;
         }
     }
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
index ab7687f..96d2c72 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/jdbc/DatabaseUtil.java
@@ -205,7 +205,7 @@ public class DatabaseUtil {
 
         List<ModelEntity> modelEntityList = new ArrayList<>(modelEntities.values());
         // sort using compareTo method on ModelEntity
-        Collections.sort(modelEntityList);
+        modelEntityList.sort(null);
         int curEnt = 0;
         int totalEnt = modelEntityList.size();
         List<ModelEntity> entitiesAdded = new LinkedList<>();
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java
index 30efe74..ec30b24 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityDataLoader.java
@@ -175,7 +175,7 @@ public class EntityDataLoader {
                             }
                         }
                     }
-                    Collections.sort(tempFileList);
+                    tempFileList.sort(null);
                     for (File dataFile: tempFileList) {
                         if (dataFile.exists()) {
                             URL url = null;
diff --git a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java
index bd873f3..7187eaf 100644
--- a/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java
+++ b/framework/entity/src/main/java/org/apache/ofbiz/entity/util/EntityUtil.java
@@ -361,7 +361,7 @@ public final class EntityUtil {
         List<T> result = new ArrayList<>();
         result.addAll(values);
         if (Debug.verboseOn()) Debug.logVerbose("Sorting " + values.size() + " values, orderBy=" + orderBy.toString(), MODULE);
-        Collections.sort(result, new OrderByList(orderBy));
+        result.sort(new OrderByList(orderBy));
         return result;
     }
 
diff --git a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java
index 68af57e..be3f760 100644
--- a/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java
+++ b/framework/minilang/src/main/java/org/apache/ofbiz/minilang/method/envops/OrderMapList.java
@@ -74,7 +74,7 @@ public final class OrderMapList extends MethodOperation {
         }
         List<Map<Object, Object>> orderList = listFma.get(methodContext.getEnvMap());
         if (orderList != null) {
-            Collections.sort(orderList, mc);
+            orderList.sort(mc);
         }
         return true;
     }
diff --git a/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java b/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java
index 74d3c47..232ad60 100644
--- a/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java
+++ b/framework/service/src/main/java/org/apache/ofbiz/service/calendar/RecurrenceInfo.java
@@ -105,8 +105,8 @@ public class RecurrenceInfo {
         eDateList = RecurrenceUtil.parseDateList(StringUtil.split(info.getString("exceptionDateTimes"), ","));
 
         // Sort the lists.
-        Collections.sort(rDateList);
-        Collections.sort(eDateList);
+        rDateList.sort(null);
+        eDateList.sort(null);
     }
 
     /** Returns the primary key for this value object */