String (@NotNull Collection<?> collection, @NotNull String separator) { List<String> list = ContainerUtil.map(collection, String::valueOf); Collections.sort(list); StringBuilder builder = new StringBuilder(); boolean flag = false; for (final String o : list) { if (flag) { builder.append(separator); } builder.append(o); flag = true; } return builder.toString(); }