Package lumis.util.collections
Class Collections
- java.lang.Object
-
- lumis.util.collections.Collections
-
public abstract class Collections extends 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> String
stringify(Collection<Type> collection, String prefix, String suffix, boolean includePrefixAndSuffixOnlyIfCollectionNotEmpty, String separator, IStringify<Type> stringify)
Creates a string representation of the given collection, using its values.static <Type> String
stringify(Collection<Type> collection, String prefix, String suffix, String separator, IStringify<Type> stringify)
Creates a string representation of the given collection, using its values.static <Type> String
stringify(Collection<Type> collection, String separator, IStringify<Type> stringify)
Creates a string representation of the given collection, using its values.static <Type> String
stringify(Collection<Type> collection, IStringify<Type> stringify)
Creates a string representation of the given collection, using its values.static <From,To>
Collection<To>transform(Collection<From> original, Transformer<From,To> transformer)
Returns a new collection using the given transformer to transform the items.static <T> Collection<T>
union(Collection<T>... cs)
Returns the union of the given collections.
-
-
-
Method Detail
-
transform
public static <From,To> Collection<To> transform(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> String stringify(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 returnednull
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> String stringify(Collection<Type> collection, 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 returnednull
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> String stringify(Collection<Type> collection, String prefix, String suffix, 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 returnednull
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> String stringify(Collection<Type> collection, String prefix, String suffix, boolean includePrefixAndSuffixOnlyIfCollectionNotEmpty, 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 returnednull
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> Collection<T> union(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
-
-