Package org.keycloak.common.util
Class CollectionUtil
java.lang.Object
org.keycloak.common.util.CollectionUtil
- Author:
- Jeroen Rosenberg
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> booleancollectionEquals(Collection<T> col1, Collection<T> col2) static <T> Set<T>collectionToSet(Collection<T> collection) static booleanisEmpty(Collection<?> collection) static booleanisNotEmpty(Collection<?> collection) static Stringjoin(Collection<String> strings) static Stringjoin(Collection<String> strings, String separator) partition(Collection<T> items, int chunkSize) Splits the given collection into consecutive chunks of at mostchunkSizeelements, preserving iteration order.
-
Constructor Details
-
CollectionUtil
public CollectionUtil()
-
-
Method Details
-
join
-
join
-
collectionEquals
-
isEmpty
-
isNotEmpty
-
collectionToSet
-
partition
Splits the given collection into consecutive chunks of at mostchunkSizeelements, preserving iteration order. Every chunk except possibly the last has exactlychunkSizeelements. The returned chunks are independent copies and do not reference the source collection.- Parameters:
items- the collection to split; may benullchunkSize- the maximum number of elements per chunk; must be greater than 0- Returns:
- list of chunks; an empty list if
itemsisnullor empty - Throws:
IllegalArgumentException- ifchunkSizeis not positive
-