Class Collections


  • public abstract class Collections
    extends java.lang.Object
    Collection utilities methods.
    Since:
    8.1.0
    Version:
    $Revision: 20413 $ $Date: 2017-07-20 16:57:40 -0300 (Thu, 20 Jul 2017) $
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <Type> java.lang.String stringify​(java.util.Collection<Type> collection, java.lang.String prefix, java.lang.String suffix, boolean includePrefixAndSuffixOnlyIfCollectionNotEmpty, java.lang.String separator, IStringify<Type> stringify)
      Creates a string representation of the given collection, using its values.
      static <Type> java.lang.String stringify​(java.util.Collection<Type> collection, java.lang.String prefix, java.lang.String suffix, java.lang.String separator, IStringify<Type> stringify)
      Creates a string representation of the given collection, using its values.
      static <Type> java.lang.String stringify​(java.util.Collection<Type> collection, java.lang.String separator, IStringify<Type> stringify)
      Creates a string representation of the given collection, using its values.
      static <Type> java.lang.String stringify​(java.util.Collection<Type> collection, IStringify<Type> stringify)
      Creates a string representation of the given collection, using its values.
      static <From,​To>
      java.util.Collection<To>
      transform​(java.util.Collection<From> original, Transformer<From,​To> transformer)
      Returns a new collection using the given transformer to transform the items.
      static <T> java.util.Collection<T> union​(java.util.Collection<T>... cs)
      Returns the union of the given collections.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • transform

        public static <From,​To> java.util.Collection<To> transform​(java.util.Collection<From> original,
                                                                         Transformer<From,​To> transformer)
                                                                  throws PortalException
        Returns a new collection using the given transformer to transform the items.
        Parameters:
        original - the original collection.
        transformer - the transformed to be used.
        Returns:
        a new collection using the given transformer to transform the items.
        Throws:
        PortalException
        Since:
        8.1.0
      • stringify

        public static <Type> java.lang.String stringify​(java.util.Collection<Type> collection,
                                                        IStringify<Type> stringify)
                                                 throws PortalException
        Creates a string representation of the given collection, using its values. By convention, does not check whether the given stringify has returned null before concatenating to the result string.
        Parameters:
        collection - the collection.
        stringify - the stringfy to be used to convert values in strings.
        Returns:
        the created string.
        Throws:
        PortalException
        Since:
        9.0.0
      • stringify

        public static <Type> java.lang.String stringify​(java.util.Collection<Type> collection,
                                                        java.lang.String separator,
                                                        IStringify<Type> stringify)
                                                 throws PortalException
        Creates a string representation of the given collection, using its values. By convention, does not check whether the given stringify has returned null before concatenating to the result string.
        Parameters:
        collection - the collection.
        separator - the separator to use between the entries of the map.
        stringify - the stringfy to be used to convert values in strings.
        Returns:
        the created string.
        Throws:
        PortalException
        Since:
        9.0.0
      • stringify

        public static <Type> java.lang.String stringify​(java.util.Collection<Type> collection,
                                                        java.lang.String prefix,
                                                        java.lang.String suffix,
                                                        java.lang.String separator,
                                                        IStringify<Type> stringify)
                                                 throws PortalException
        Creates a string representation of the given collection, using its values. By convention, does not check whether the given stringify has returned null before concatenating to the result string.
        Parameters:
        collection - the collection.
        prefix - the prefix to be appended in final string.
        suffix - the suffix to be appended in final string.
        separator - the separator to use between the entries of the map.
        stringify - the stringfy to be used to convert values in strings.
        Returns:
        the created string.
        Throws:
        PortalException
        Since:
        9.0.0
      • stringify

        public static <Type> java.lang.String stringify​(java.util.Collection<Type> collection,
                                                        java.lang.String prefix,
                                                        java.lang.String suffix,
                                                        boolean includePrefixAndSuffixOnlyIfCollectionNotEmpty,
                                                        java.lang.String separator,
                                                        IStringify<Type> stringify)
                                                 throws PortalException
        Creates a string representation of the given collection, using its values. By convention, does not check whether the given stringify has returned null before concatenating to the result string.
        Parameters:
        collection - the collection.
        prefix - the prefix to be appended in final string.
        suffix - the suffix to be appended in final string.
        includePrefixAndSuffixOnlyIfCollectionNotEmpty - indicates whether prefix and suffix should be added only if the given collection is not empty.
        separator - the separator to use between the entries of the map.
        stringify - the stringfy to be used to convert values in strings.
        Returns:
        the created string.
        Throws:
        PortalException
        Since:
        9.0.0
      • union

        @SafeVarargs
        public static <T> java.util.Collection<T> union​(java.util.Collection<T>... cs)
        Returns the union of the given collections.
        Parameters:
        cs - the collections.
        Returns:
        the union of the given collections.
        Since:
        10.2.0