Improved: Inline ‘StringUtil#quoteStrList’ method

(OFBIZ-11014)


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1859924 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mathieu Lirzin
2019-05-25 09:17:12 +00:00
parent 7bd53374ed
commit b97461e47a
3 changed files with 3 additions and 22 deletions
@@ -139,21 +139,6 @@ public class StringUtil {
return splitList;
}
/**
* Encloses each of a List of Strings in quotes.
* @param list List of String(s) to quote.
*/
public static List<String> quoteStrList(List<String> list) {
List<String> tmpList = list;
list = new LinkedList<>();
for (String str: tmpList) {
str = "'" + str + "'";
list.add(str);
}
return list;
}
/**
* Creates a Map from an encoded name/value pair string
* @param str The string to decode and format
@@ -79,11 +79,6 @@ public class StringUtilTests extends GenericTestCaseBase {
assertEquals("no-sep", list("1", "2", "3", "4", "5", "6"), StringUtil.split("1 2\t3\n4\r5\f6", null));
}
public void testQuoteStrList() {
assertEquals("single", list("'1'"), StringUtil.quoteStrList(list("1")));
assertEquals("double", list("'1'", "'2'"), StringUtil.quoteStrList(list("1", "2")));
}
public void testStrToMap() {
assertNull("null-string", StringUtil.strToMap(null, false));
assertEquals("missing =", Collections.emptyMap(), StringUtil.strToMap("1", false));