abstract class CollectionUtils
Miscellaneous collection utility methods. Mainly for internal use within the framework.
Author
Juergen Hoeller
Author
Rob Harrop
Author
Arjen Poutsma
Since
1.1.3
CollectionUtils()
Miscellaneous collection utility methods. Mainly for internal use within the framework. |
open static fun arrayToList(source: Any): MutableList<Any?>
Convert the supplied array into a List. A primitive array gets converted into a List of the appropriate wrapper type. NOTE: Generally prefer the standard A |
|
open static fun contains(iterator: MutableIterator<*>, element: Any): Boolean
Check whether the given Iterator contains the given element. open static fun contains(enumeration: Enumeration<*>, element: Any): Boolean
Check whether the given Enumeration contains the given element. |
|
open static fun containsAny(source: MutableCollection<*>, candidates: MutableCollection<*>): Boolean
Return |
|
open static fun containsInstance(collection: MutableCollection<*>, element: Any): Boolean
Check whether the given Collection contains the given element instance. Enforces the given instance to be present, rather than returning |
|
open static fun findCommonElementType(collection: MutableCollection<*>): Class<*>
Find the common element type of the given Collection, if any. |
|
open static fun <E : Any> findFirstMatch(source: MutableCollection<*>, candidates: MutableCollection<E>): E
Return the first element in ' |
|
open static fun <T : Any> findValueOfType(collection: MutableCollection<*>, type: Class<T>): T
Find a single value of the given type in the given Collection. open static fun findValueOfType(collection: MutableCollection<*>, types: Array<Class<*>>): Any
Find a single value of one of the given types in the given Collection: searching the Collection for a value of the first type, then searching for a value of the second type, etc. |
|
open static fun hasUniqueObject(collection: MutableCollection<*>): Boolean
Determine whether the given Collection only contains a single unique object. |
|
open static fun isEmpty(collection: MutableCollection<*>): Boolean
Return open static fun isEmpty(map: MutableMap<*, *>): Boolean
Return |
|
open static fun <E : Any> mergeArrayIntoCollection(array: Any, collection: MutableCollection<E>): Unit
Merge the given array into the given Collection. |
|
open static fun <K : Any, V : Any> mergePropertiesIntoMap(props: Properties, map: MutableMap<K, V>): Unit
Merge the given Properties instance into the given Map, copying all properties (key-value pairs) over. Uses |
|
open static fun <A : Any, E : A> toArray(enumeration: Enumeration<E>, array: Array<A>): Array<A>
Marshal the elements from the given enumeration into an array of the given type. Enumeration elements must be assignable to the type of the given array. The array returned will be a different instance than the array given. |
|
open static fun <E : Any> toIterator(enumeration: Enumeration<E>): MutableIterator<E>
Adapt an enumeration to an iterator. |
|
open static fun <K : Any, V : Any> toMultiValueMap(map: MutableMap<K, MutableList<V>>): MultiValueMap<K, V>
Adapt a |
|
open static fun <K : Any, V : Any> unmodifiableMultiValueMap(map: MultiValueMap<out K, out V>): MultiValueMap<K, V>
Return an unmodifiable view of the specified multi-value map. |