@Test public void testShouldMapCommaListWithThreeItems() { String strList = HttpHeadersTools.set2commastr(threeItems); assertEquals("AAA,BBB,CCC", strList); }
public static String set2commastr(Set<String> values) { int i; List<String> valList = new ArrayList<String>(values); Collections.sort(valList); Object[] objAry = valList.toArray(); StringBuilder sb = new StringBuilder(); if (objAry.length == 0) { return sb.toString(); } i = 1; for (i = 0; i < objAry.length - 1; i++) { sb.append(String.format("%s,", (String) objAry[i])); } sb.append(objAry[i]); return sb.toString(); }
HttpHeadersTools { public static String set2commastr(Set<String> values) { int i; List<String> valList = new ArrayList<String>(values); Collections.sort(valList); Object[] objAry = valList.toArray(); StringBuilder sb = new StringBuilder(); if (objAry.length == 0) { return sb.toString(); } i = 1; for (i = 0; i < objAry.length - 1; i++) { sb.append(String.format("%s,", (String) objAry[i])); } sb.append(objAry[i]); return sb.toString(); } }
HttpHeadersTools { public static String set2commastr(Set<String> values) { int i; List<String> valList = new ArrayList<String>(values); Collections.sort(valList); Object[] objAry = valList.toArray(); StringBuilder sb = new StringBuilder(); if (objAry.length == 0) { return sb.toString(); } i = 1; for (i = 0; i < objAry.length - 1; i++) { sb.append(String.format("%s,", (String) objAry[i])); } sb.append(objAry[i]); return sb.toString(); } HttpHeadersTools();  HttpHeadersTools(HttpServletRequest req, HttpServletResponse res); }
HttpHeadersTools { public static String set2commastr(Set<String> values) { int i; List<String> valList = new ArrayList<String>(values); Collections.sort(valList); Object[] objAry = valList.toArray(); StringBuilder sb = new StringBuilder(); if (objAry.length == 0) { return sb.toString(); } i = 1; for (i = 0; i < objAry.length - 1; i++) { sb.append(String.format("%s,", (String) objAry[i])); } sb.append(objAry[i]); return sb.toString(); } HttpHeadersTools();  HttpHeadersTools(HttpServletRequest req, HttpServletResponse res); boolean isValidAuth(); boolean isBasicAuth(); HttpServletRequest getReq(); void setReq(HttpServletRequest req); HttpServletResponse getRes(); void setRes(HttpServletResponse res); String getBasicString(); String getBasicUser(); String getBasicPassword(); boolean isHeaderTrue(String name); static Set<String> commastr2set(String valueStr); static String set2commastr(Set<String> values); }
HttpHeadersTools { public static String set2commastr(Set<String> values) { int i; List<String> valList = new ArrayList<String>(values); Collections.sort(valList); Object[] objAry = valList.toArray(); StringBuilder sb = new StringBuilder(); if (objAry.length == 0) { return sb.toString(); } i = 1; for (i = 0; i < objAry.length - 1; i++) { sb.append(String.format("%s,", (String) objAry[i])); } sb.append(objAry[i]); return sb.toString(); } HttpHeadersTools();  HttpHeadersTools(HttpServletRequest req, HttpServletResponse res); boolean isValidAuth(); boolean isBasicAuth(); HttpServletRequest getReq(); void setReq(HttpServletRequest req); HttpServletResponse getRes(); void setRes(HttpServletResponse res); String getBasicString(); String getBasicUser(); String getBasicPassword(); boolean isHeaderTrue(String name); static Set<String> commastr2set(String valueStr); static String set2commastr(Set<String> values);  }