title: How to iterate through all values of a nested map in groovy
body: <p>I have a nested map of unknown structure, the goal is to iterate through every value in the map, check the values of a certain condition (e.g. null) and replace those values with something else. I can see how to do it if the map structure is known, but the issue here is that it is unknown.</p>
  
  <p>For example this could be the map structure passed (or could have any number of nested maps):</p>
  
  <pre><code>​def map = [
            a:5,
            b:"r",
            c:[ a1:0, b1:null ],
            d:[ a2: [ a3:"", b3:99 ], b2:null ],
            ...
  ]
  </code></pre>
  
  <p>Normally for a simple map one would use a this to update values:</p>
  
  <pre><code>map.each { it.value == null ? it.value = "" : "" }
  </code></pre>
  
  <p>However with an nested map structure this approach will not work.</p>
  
  <p>Is there an efficient way to iterating through all the nested values of an unknown map to investigate and update the values?</p>