Skip to content

Commit

Permalink
Improved: Remove useless ‘UtilMisc#makeSetWritable’ method
Browse files Browse the repository at this point in the history
(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 e8a6567
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -307,7 +308,7 @@ public static Map<String, Object> persistContentAndAssoc(DispatchContext dctx, M
// 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -606,7 +607,7 @@ public static Map<String, Object> attachProductFeaturesToCategory(DispatchContex
if (UtilValidate.isNotEmpty(includeProp)) {
List<String> typeList = StringUtil.split(includeProp, ",");
if (typeList.size() > 0) {
productFeatureTypeIdsToInclude = UtilMisc.makeSetWritable(typeList);
productFeatureTypeIdsToInclude = new LinkedHashSet<>(typeList);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -817,7 +818,7 @@ public static class ProductSetConstraint extends WorkEffortSearchConstraint {
protected Set<String> productIdSet;

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

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,14 +173,6 @@ public static <K, V> Map<K, V> makeMapWritable(Map<K, ? extends V> map) {
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.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ public static Map<String, Object> executeFind(DispatchContext dctx, Map<String,
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;
Expand Down

0 comments on commit e8a6567

Please sign in to comment.