All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.carrot2.util.CollectionUtils Maven / Gradle / Ivy

There is a newer version: 0.2.13
Show newest version
package org.carrot2.util;

import java.util.Collection;

/**
 * Various utility methods for working with {@link Collection}s.
 */
public class CollectionUtils
{
    /**
     * Converts a {@link Collection} to a {@link String} separating entries by
     * , .
     */
    public static String toString(Collection collection)
    {
        final StringBuffer string = new StringBuffer();
        for (final Object object : collection)
        {
            string.append(object.toString());
            string.append(", ");
        }

        string.delete(string.length() - 2, string.length());

        return string.toString();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy