Weird java for-each behavior when swapping variables
<p>With the follow code, I expect four elements, but get only three.  Clearly I'm doing something crazy silly.</p>

<pre><code>import java.util.HashSet;

import java.util.Set;

public class MyTest {
    public static void main(String[] args) {
        String[] myStrings = new String[] { "a", "b" };

        Set&lt;String&gt; set = new HashSet&lt;String&gt;();
        for (String x : myStrings) {
            for (String y : myStrings) {
                String temp = x;
                x = y;
                y = temp;

                set.add(x + y);
            }
        }

        System.out.println(set);
    }
}
</code></pre>

<p>result:</p>

<pre><code>[ba, aa, ab]
</code></pre>
