Groovy: replace all values in list with modified value
<p>I have a map which contains a list of values. I need to update every value in said list with an encoded/encrypted version of that value.</p>

<p>The map and list could be nested anywhere and I'm just given a path of what to change. For example <code>myMap.myList.*myObject</code></p>

<p>my map of lists look like this:</p>

<pre><code> mymap {"myList" : [{myObject : "aaa" }, {myObject : "bbb"}]}
</code></pre>

<p>I am given this path :  <code>'myList*myObj'</code></p>

<p>Code to try and update the values:</p>

<pre><code>     myMap = [myList : [[myObject : "aaa"], [myObject : "bbb"]]];
     path = 'myList*.myObject';
     result = Eval.x(myMap, 'x.' + path + '="somenewvalue"');
</code></pre>

<p>This works and replaces all values with 'somenewvalue' However I need to replace  each value with the encrypted version of its original value So of 'aaa' with the encrypted version of 'aaa' and 'bbb' with the encrypted version of 'bbb' and so on.</p>

<p>But this will set all values to the same value. how can I set the values to different ones?</p>