Author: mthl
Date: Wed May 8 21:42:27 2019 New Revision: 1858951 URL: http://svn.apache.org/viewvc?rev=1858951&view=rev Log: Improved: Remove useless ‘UtilMisc#makeSetWritable’ method (OFBIZ-11015) Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java Modified: ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java?rev=1858951&r1=1858950&r2=1858951&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/content/src/main/java/org/apache/ofbiz/content/ContentManagementServices.java Wed May 8 21:42:27 2019 @@ -23,6 +23,7 @@ import java.nio.ByteBuffer; import java.sql.Timestamp; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -307,7 +308,7 @@ public class ContentManagementServices { // Add ContentPurposes if this is a create operation if (contentId != null && !contentExists) { try { - Set<String> contentPurposeSet = UtilMisc.makeSetWritable(contentPurposeList); + Set<String> contentPurposeSet = new LinkedHashSet<>(contentPurposeList); for (String contentPurposeTypeId : contentPurposeSet) { GenericValue contentPurpose = delegator.makeValue("ContentPurpose", UtilMisc.toMap("contentId", contentId, "contentPurposeTypeId", contentPurposeTypeId)); contentPurpose.create(); Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java?rev=1858951&r1=1858950&r2=1858951&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductUtilServices.java Wed May 8 21:42:27 2019 @@ -21,6 +21,7 @@ package org.apache.ofbiz.product.product import java.sql.Timestamp; import java.util.HashMap; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.List; import java.util.Locale; import java.util.Map; @@ -606,7 +607,7 @@ public final class ProductUtilServices { if (UtilValidate.isNotEmpty(includeProp)) { List<String> typeList = StringUtil.split(includeProp, ","); if (typeList.size() > 0) { - productFeatureTypeIdsToInclude = UtilMisc.makeSetWritable(typeList); + productFeatureTypeIdsToInclude = new LinkedHashSet<>(typeList); } } Modified: ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java?rev=1858951&r1=1858950&r2=1858951&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java (original) +++ ofbiz/ofbiz-framework/trunk/applications/workeffort/src/main/java/org/apache/ofbiz/workeffort/workeffort/WorkEffortSearch.java Wed May 8 21:42:27 2019 @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.Iterator; +import java.util.LinkedHashSet; import java.util.LinkedList; import java.util.List; import java.util.Locale; @@ -817,7 +818,7 @@ public class WorkEffortSearch { protected Set<String> productIdSet; public ProductSetConstraint(Collection<String> productIdSet) { - this.productIdSet = UtilMisc.makeSetWritable(productIdSet); + this.productIdSet = new LinkedHashSet<>(productIdSet); } @Override Modified: ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java?rev=1858951&r1=1858950&r2=1858951&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/base/src/main/java/org/apache/ofbiz/base/util/UtilMisc.java Wed May 8 21:42:27 2019 @@ -173,14 +173,6 @@ public final class UtilMisc { return result; } - public static <T> Set<T> makeSetWritable(Collection<? extends T> col) { - Set<T> result = new LinkedHashSet<>(); - if (col != null) { - result.addAll(col); - } - return result; - } - /** * This change a Map to be Serializable by removing all entries with values that are not Serializable. * Modified: ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java?rev=1858951&r1=1858950&r2=1858951&view=diff ============================================================================== --- ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java (original) +++ ofbiz/ofbiz-framework/trunk/framework/common/src/main/java/org/apache/ofbiz/common/FindServices.java Wed May 8 21:42:27 2019 @@ -674,7 +674,7 @@ public class FindServices { Locale locale = (Locale) context.get("locale"); Set<String> fieldSet = null; if (fieldList != null) { - fieldSet = UtilMisc.makeSetWritable(fieldList); + fieldSet = new LinkedHashSet<>(fieldList); } Integer maxRows = (Integer) context.get("maxRows"); maxRows = maxRows != null ? maxRows : -1; |
Free forum by Nabble | Edit this page |