Package org.camunda.bpm.engine.impl.util
Class CollectionUtil
- java.lang.Object
-
- org.camunda.bpm.engine.impl.util.CollectionUtil
-
public class CollectionUtil extends java.lang.Object
helper/convience methods for working with collections.- Author:
- Joram Barrez
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <S,T>
voidaddCollectionToMapOfSets(java.util.Map<S,java.util.Set<T>> map, S key, java.util.Collection<T> values)
static <S,T>
voidaddToMapOfLists(java.util.Map<S,java.util.List<T>> map, S key, T value)
static <S,T>
voidaddToMapOfSets(java.util.Map<S,java.util.Set<T>> map, S key, T value)
static <T> java.util.List<T>
asArrayList(T[] values)
Arrays.asList cannot be reliably used for SQL parameters on MyBatis < 3.3.0static <T> java.util.Set<T>
asHashSet(T... elements)
static <T> java.util.List<T>
collectInList(java.util.Iterator<T> iterator)
static boolean
isEmpty(java.util.Collection<?> collection)
static <T> java.util.List<java.util.List<T>>
partition(java.util.List<T> list, int partitionSize)
Chops a list into non-view sublists of length partitionSize.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 Collections.singletonMap(), since that method returns a generic typed mapdepending on the input type, but we often need a map.
-
asArrayList
public static <T> java.util.List<T> asArrayList(T[] values)
Arrays.asList cannot be reliably used for SQL parameters on MyBatis < 3.3.0
-
asHashSet
public static <T> java.util.Set<T> asHashSet(T... elements)
-
addToMapOfLists
public static <S,T> void addToMapOfLists(java.util.Map<S,java.util.List<T>> map, S key, T value)
-
addToMapOfSets
public static <S,T> void addToMapOfSets(java.util.Map<S,java.util.Set<T>> map, S key, T value)
-
addCollectionToMapOfSets
public static <S,T> void addCollectionToMapOfSets(java.util.Map<S,java.util.Set<T>> map, S key, java.util.Collection<T> values)
-
partition
public static <T> java.util.List<java.util.List<T>> partition(java.util.List<T> list, int partitionSize)
Chops a list into non-view sublists of length partitionSize. Note: the argument list may be included in the result.
-
collectInList
public static <T> java.util.List<T> collectInList(java.util.Iterator<T> iterator)
-
isEmpty
public static boolean isEmpty(java.util.Collection<?> collection)
-
-