Permutation of a 2D array
<p>Here comes another question about permutations. I have done everything I can to formulate my problem as good as I possibly can. Feel free to ask questions if there is something you do not understand.</p>

<p>I have a list, containing a list, containing a list, containing a symbol.</p>

<pre><code>List&lt;List&lt;List&lt;Symbol&gt;&gt;&gt; list = new ArrayList&lt;List&lt;List&lt;Symbol&gt;&gt;&gt;();
</code></pre>

<p>The symbol class simply takes on a value and keeps track of some important features of what I am creating. All the symbols in the structure are different from one another.</p>

<p>There are however some difficulties as to just switching places in all different ways, since...</p>

<p><strong>The first list</strong> is a sort of wrapper for the whole thing. It contains groupings of two lists containing symbols. This is because the symbols are not supposed to be seperate from one another when contained in a grouping.</p>

<p><strong>The second list</strong> is always of length two, and each contains a list of unique symbols. As to why it is two, do not ask me for this question. It would be nice for this program to have the capability to also be able to deal with this list being greater than two in length.</p>

<p><strong>The third list</strong> contains all the symbols, and there are two of those per wrapper, as stated above.</p>

<p>What I want with this is to generate all possible permutations and analyze them. That is, I would like the symbols to switch into all possible combination whilst still being contained within its respective list.</p>

<p>This could look something like this (written in pseudo-code, depicting the list-like structure mentioned above).</p>

<pre><code>[[a, b, c], [d, e, f]],
[[g, h, i, j], [k, l, m, n]],
[[o, p], [q, r]],
[[s, t, u], [v, x, y]],
</code></pre>

<p>An example for what one of the (possibly thousands) of permutations could be, is this.</p>

<pre><code>[[c, a, b], [d, f, e]],
[[g, h, j, i], [k, l, m, n]],
[[o, p], [q, r]],
[[s, t, u], [v,y, x]],
</code></pre>

<p><strong>What I have tried so far</strong> is to put these into a good old traditional permutations method that works for a single array (or list, if you will), and tried to modify that into working with multidimensional arrays. Surely there is a good and simple way to do this, preferably with the use of recursion. Should there be a way without, that is totally okay.</p>

<p>Once again, if you have any questions above what I just wrote, feel free to post a comment.</p>

<p>Kind regards,</p>