Skip to content

Commit

Permalink
Improved: Remove ‘UtilMisc#toList’
Browse files Browse the repository at this point in the history
(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 6a99c09
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -303,12 +303,10 @@ public static List<GenericValue> productOrderByMap(List<GenericValue> values, Ma
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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,18 +368,6 @@ public static <T> List<T> toList(T... data) {
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;
Expand Down

0 comments on commit 6a99c09

Please sign in to comment.