Package 

Object CollectionUtil

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • 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")
        )
      )
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • 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",
        )
      • unflatten

         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")
          )
        )