title: Impossibility to iterate over a Map using Groovy within Jenkins Pipeline
body: <p>We are trying to iterate over a <code>Map</code>, but without any success. We reduced our issue to this minimal example:</p>
  
  <pre><code>def map = [
             'monday': 'mon',
             'tuesday': 'tue',
             ]
  </code></pre>
  
  <p>If we try to iterate with:</p>
  
  <pre><code>map.each{ k, v -&gt; println "${k}:${v}" }
  </code></pre>
  
  <p>Only the first entry is output: <code>monday:mon</code></p>
  
  <hr>
  
  <p>The alternatives we know of are not even able to enter the loop:</p>
  
  <pre><code>for (e in map)
  {
      println "key = ${e.key}, value = ${e.value}"
  }
  </code></pre>
  
  <p>or</p>
  
  <pre><code>for (Map.Entry&lt;String, String&gt; e: map.entrySet())
  {
      println "key = ${e.key}, value = ${e.value}"
  }
  </code></pre>
  
  <p>Are failing, both only showing the exception <code>java.io.NotSerializableException: java.util.LinkedHashMap$Entry</code>. (which could be related to an exception occurring while raising the 'real' exception, preventing us from knowing what happened).</p>
  
  <p>We are using latest stable jenkins (2.19.1) with all plugins up-to-date as of today (2016/10/20).</p>
  
  <p>Is there a solution to iterate over elements in a <code>Map</code> within a Jenkins pipeline Groovy script ?</p>