title: Looping Hashmap in jenkins file and passing keys to shell or powershell or bat, Not working
body: <p>I have a jenkins file where I am trying to loop over one <em><strong>Array</strong></em> and passing its <strong>elements</strong> to Shell script block, It is Working Fine
  But, when I am Looping over <em><strong>Hashmap</strong></em> and trying to pass Its <strong>Keys</strong> it throws an error.</p>
  <pre><code>stage('Validation'){
          steps{
              script{ 
                  test1 = [&quot;elem1&quot;,&quot;elem2&quot;]
                  test2 = [key1:&quot;value1&quot;, key2:&quot;value2&quot;]
                                     
                  for(defaults in test1){
                      test=defaults
                      echo &quot;before shell====&gt; ${test}&quot;
                      status = sh(returnStdout: true,  script: &quot;&quot;&quot;
                          echo &quot;${test}&quot;
                      &quot;&quot;&quot;).trim() 
                  }
                  echo &quot;======started next HashMAP loop===========&quot;
                  for(defaults in test2){
                      test=defaults.key
                      echo &quot;before shell====&gt; ${test}&quot;
                      status = sh(returnStdout: true,  script: &quot;&quot;&quot;
                          echo &quot;${test}&quot;
                      &quot;&quot;&quot;).trim() 
                  }
            }
       }
   }
  </code></pre>
  <p>Where the output:</p>
  <p><a href="https://i.stack.imgur.com/ngT9K.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ngT9K.png" alt="enter image description here" /></a></p>
  <p>Last Error :</p>
  <blockquote>
  <p>Caused: java.io.NotSerializableException: java.util.LinkedHashMap$Entry</p>
  </blockquote>