Class CollectionUtil
- java.lang.Object
-
- org.flowable.common.engine.impl.util.CollectionUtil
-
public class CollectionUtil extends Object
helper/convenience methods for working with collections.- Author:
- Joram Barrez
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> voidconsumePartitions(Collection<T> values, int partitionSize, Consumer<List<T>> partitionConsumer)static booleanisEmpty(Collection collection)static booleanisNotEmpty(Collection collection)static Map<String,Object>map(Object... objects)Helper method to easily create a map.static <T> List<List<T>>partition(Collection<T> values, int partitionSize)static Map<String,Object>singletonMap(String key, Object value)Helper method that creates a singleton map.
-
-
-
Method Detail
-
singletonMap
public static Map<String,Object> singletonMap(String key, Object value)
Helper method that creates a singleton map. Alternative for Collections.singletonMap(), since that method returns a generic typed map depending on the input type, but we often need a String, Object map.
-
map
public static Map<String,Object> map(Object... objects)
Helper method to easily create a map. Takes as input a varargs containing the key1, value1, key2, value2, etc. Note: although an Object, we will cast the key to String internally.
-
isEmpty
public static boolean isEmpty(Collection collection)
-
isNotEmpty
public static boolean isNotEmpty(Collection collection)
-
partition
public static <T> List<List<T>> partition(Collection<T> values, int partitionSize)
-
consumePartitions
public static <T> void consumePartitions(Collection<T> values, int partitionSize, Consumer<List<T>> partitionConsumer)
-
-