Skip to content
Permalink
Browse files

Improved: Remove ‘UtilMisc#toList’

(OFBIZ-11140)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1863442 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
mthl committed Jul 19, 2019
1 parent df8586e commit 6a99c09a18ae097c6bfdac8a295b5f9f51a35d04
@@ -303,12 +303,10 @@ private ProductDisplayWorker() {}
return null;
}
if (values.size() == 0) {
return UtilMisc.toList(values);
return values;
}

List<GenericValue> result = new LinkedList<>();
result.addAll(values);

List<GenericValue> result = new LinkedList<>(values);
Collections.sort(result, new ProductByMapComparator(orderByMap, descending));
return result;
}
@@ -1169,10 +1169,10 @@ private static void populateAddressesFromMessage(MimeMessageWrapper wrapper, Map
emailAddressesBCC.add(((InternetAddress) element).getAddress());
}
}
String fromString = StringUtil.join(UtilMisc.toList(emailAddressesFrom), ",");
String toString = StringUtil.join(UtilMisc.toList(emailAddressesTo), ",");
String ccString = StringUtil.join(UtilMisc.toList(emailAddressesCC), ",");
String bccString = StringUtil.join(UtilMisc.toList(emailAddressesBCC), ",");
String fromString = StringUtil.join(emailAddressesFrom, ",");
String toString = StringUtil.join(emailAddressesTo, ",");
String ccString = StringUtil.join(emailAddressesCC, ",");
String bccString = StringUtil.join(emailAddressesBCC, ",");

if (UtilValidate.isNotEmpty(fromString)) {
commEventMap.put("fromString", fromString);
@@ -368,18 +368,6 @@ public static String collectionToString(Collection<? extends Object> values, Str
return list;
}

public static <T> List<T> toList(Collection<T> collection) {
if (collection == null) {
return null;
}
if (collection instanceof List<?>) {
return (List<T>) collection;
}
List<T> list = new LinkedList<>();
list.addAll(collection);
return list;
}

public static <T> List<T> toListArray(T[] data) {
if (data == null) {
return null;

0 comments on commit 6a99c09

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