StringUtils { @SafeVarargs static <T> String getList(final String concatenator, final T... objects) { final StringBuilder stringBuilder = new StringBuilder(); if (objects != null && objects.length > 0) { for (final Object o : objects) { stringBuilder.append(o.toString().toLowerCase(Locale.US)).append(concatenator); } stringBuilder.setLength(stringBuilder.length() - concatenator.length()); } return stringBuilder.toString(); } private  StringUtils();   }
@Test public void getList() { assertEquals("", StringUtils.getList(",")); assertEquals("", StringUtils.getList(",", null)); assertEquals("", StringUtils.getList(",", new Object[0])); assertEquals("3,4,5,6", StringUtils.getList(",", 3, 4, 5, 6)); assertEquals("7", StringUtils.getList(",", 7)); }