Java Utililty Methods Collection Combine

List of utility methods to do Collection Combine

Description

The list of methods to do Collection Combine are organized into topic(s).

Method

StringcombineNames(Collection items)
combine Names
if ((items == null) || (items.isEmpty())) {
    return "";
if (items.size() == 1) {
    Object item = items.iterator().next();
    return item == null ? "" : item.toString();
StringBuilder rval = new StringBuilder();
...
StringcombineProblemMessages(final Collection problems)
combine Problem Messages
final StringBuilder builder = new StringBuilder("The following problems were found:\n\n");
for (final String problem : problems) {
    builder.append(problem).append("\n");
return builder.toString();
StringcombineString(Collection vec, String sep)
combine String
if ((null == vec) || (null == sep)) {
    return null;
StringBuilder sb = new StringBuilder();
boolean first = true;
for (String part : vec) {
    if (first) {
        first = false;
...
StringcombineValues(Collection values)
One of a pair of methods (the other is splitValues) that is used to combine several un-encoded values into a single delimited, encoded value for placement into a hidden field.
if (values == null || values.size() == 0) {
    return "";
} else {
    StringBuilder builder = new StringBuilder(values.size() * 30);
    for (String value : values) {
        builder.append(value).append(FIELD_DELIMITER_STRING);
    return encode(builder.toString());
...