io.arivera.oss.embedded.rabbitmq.util.StringUtils Maven / Gradle / Ivy
package io.arivera.oss.embedded.rabbitmq.util;
import java.util.Collection;
public class StringUtils {
/**
* Joins the elements of the provided collection into a single String containing the provided list of elements.
*
* No delimiter is added before or after the list.
*
* Empty collections return an empty String.
*/
public static String join(Collection collection, CharSequence joinedBy) {
if (collection.isEmpty()) {
return "";
}
StringBuilder stringBuilder = new StringBuilder(256);
for (T t : collection) {
stringBuilder.append(t.toString()).append(joinedBy);
}
return stringBuilder.substring(0, stringBuilder.length() - joinedBy.length());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy