Package org.activiti.engine.impl.util
Class CollectionUtil
- java.lang.Object
-
- org.activiti.engine.impl.util.CollectionUtil
-
public class CollectionUtil extends java.lang.Objecthelper/convenience methods for working with collections.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanisEmpty(java.util.Collection<?> collection)static booleanisNotEmpty(java.util.Collection<?> collection)static java.util.Map<java.lang.String,java.lang.Object>map(java.lang.Object... objects)Helper method to easily create a map with keys of type String and values of type Object.static <T> java.util.Map<java.lang.String,T>mapOfClass(java.lang.Class<T> clazz, java.lang.Object... objects)Helper method to easily create a map with keys of type String and values of a given Class.static java.util.Map<java.lang.String,java.lang.Object>singletonMap(java.lang.String key, java.lang.Object value)Helper method that creates a singleton map.
-
-
-
Method Detail
-
singletonMap
public static java.util.Map<java.lang.String,java.lang.Object> singletonMap(java.lang.String key, java.lang.Object value)Helper method that creates a singleton map. Alternative for singletonMap()), since that method returns a generic typed mapdepending on the input type, but we often need a map.
-
map
public static java.util.Map<java.lang.String,java.lang.Object> map(java.lang.Object... objects)
Helper method to easily create a map with keys of type String and values of type Object. Null values are allowed.- Parameters:
objects- varargs containing the key1, value1, key2, value2, etc. Note: although an Object, we will cast the key to String internally- Throws:
ActivitiIllegalArgumentException- when objects are not even or key/value are not expected types
-
mapOfClass
public static <T> java.util.Map<java.lang.String,T> mapOfClass(java.lang.Class<T> clazz, java.lang.Object... objects)Helper method to easily create a map with keys of type String and values of a given Class. Null values are allowed.- Parameters:
clazz- the target Value classobjects- varargs containing the key1, value1, key2, value2, etc. Note: although an Object, we will cast the key to String internally- Throws:
ActivitiIllegalArgumentException- when objects are not even or key/value are not expected types
-
isEmpty
public static boolean isEmpty(java.util.Collection<?> collection)
-
isNotEmpty
public static boolean isNotEmpty(java.util.Collection<?> collection)
-
-