Package lumis.util.collections
Class Collections
- java.lang.Object
-
- lumis.util.collections.Collections
-
public abstract class Collections extends java.lang.Object
Collection utilities methods.- Since:
- 8.1.0
- Version:
- $Revision: 25808 $ $Date: 2023-07-04 15:20:55 -0300 (Tue, 04 Jul 2023) $
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isNullOrEmpty(java.util.Collection<?> collection)
Returns whether the given collection isnull
or empty.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.
-
-
-
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 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> 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 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> 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 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> 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 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> 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
-
isNullOrEmpty
public static boolean isNullOrEmpty(java.util.Collection<?> collection)
Returns whether the given collection isnull
or empty.- Parameters:
collection
- the collection- Returns:
- whether the given collection is
null
or empty. - Since:
- 16.0.0
-
-