-
- All Implemented Interfaces:
public class CollectionUtil
-
-
Field Summary
Fields Modifier and Type Field Description public final static CollectionUtilINSTANCE
-
Method Summary
Modifier and Type Method Description final Map<String, Object>flatten(Map<String, Object> data)Converts nested maps and collections in the given parameter to composite string keys. final Map<String, Object>unflatten(Map<String, ?> input)Reverse operation to flatten, example: input: mapOf( "data.key1" to "value1", "data.key2[0]" to "value2", "data.key2[1]" to "value3", )output: mapOf( "data" to mapOf( "key1" to "value1", "key2" to listOf("value2", "value3") ) )-
-
Method Detail
-
flatten
final Map<String, Object> flatten(Map<String, Object> data)
Converts nested maps and collections in the given parameter to composite string keys.
Example:
input: mapOf( "data" to mapOf( "key1" to "value1", "key2" to listOf("value2", "value3") ) )output: mapOf( "data.key1" to "value1", "data.key2[0]" to "value2", "data.key2[1]" to "value3", )
-
-
-
-