Skip to content
Permalink
Browse files

Improved: Remove useless ‘UtilMisc#makeSetWritable’ method

(OFBIZ-11015)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1858951 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed May 8, 2019
1 parent 2473678 commit e8a656785a841179d7a56c62ea52c9f47a7c589e
@@ -23,6 +23,7 @@
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 @@
// 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();
@@ -21,6 +21,7 @@
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 @@ protected static void duplicateRelated(GenericValue product, String title, Strin
if (UtilValidate.isNotEmpty(includeProp)) {
List<String> typeList = StringUtil.split(includeProp, ",");
if (typeList.size() > 0) {
productFeatureTypeIdsToInclude = UtilMisc.makeSetWritable(typeList);
productFeatureTypeIdsToInclude = new LinkedHashSet<>(typeList);
}
}

@@ -23,6 +23,7 @@
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 boolean equals(Object obj) {
protected Set<String> productIdSet;

public ProductSetConstraint(Collection<String> productIdSet) {
this.productIdSet = UtilMisc.makeSetWritable(productIdSet);
this.productIdSet = new LinkedHashSet<>(productIdSet);
}

@Override
@@ -173,14 +173,6 @@ private 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.
*
@@ -674,7 +674,7 @@ public static EntityCondition createSingleCondition(ModelField modelField, Strin
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;

0 comments on commit e8a6567

Please sign in to comment.
You can’t perform that action at this time.