Class StringCollectionUtils


  • public class StringCollectionUtils
    extends Object
    Provides common utilities to handle Collections as Strings.
    • Constructor Detail

      • StringCollectionUtils

        public StringCollectionUtils()
    • Method Detail

      • commaSeparated

        public static String commaSeparated​(Collection<?> col)
        Returns a String including all elements in the Collection received as parameter separated by a comma and quoted with single quotes (').
        Parameters:
        col - A Collection to be represented as comma separated String.
        Returns:
        A String representation of col.
      • commaSeparated

        public static String commaSeparated​(Collection<?> col,
                                            boolean addQuotes)
        Returns a String including all elements in the Collection received as parameter separated by a comma.
        Parameters:
        col - A Collection to be represented as comma separated String.
        addQuotes - Should each value in the Collection be surrounded by single quotes '
        Returns:
        A String representation of col.
      • isEmptyCollection

        public static boolean isEmptyCollection​(String collection)
        Checks if a comma separated representation of a collection represents an empty collection.
        Parameters:
        collection - A comma separated representation of a collection
        Returns:
        true if the provided String represents an empty collection. Otherwise, return false.