Nested List structure management
<p>I am stuck trying to manager a list of list of lists. I have declared and initialized my data structure as so:</p>

<pre><code>List&lt;Vector&lt;ArrayDeque&lt;Vector_t&gt;&gt;&gt; mData = new ArrayList&lt;Vector&lt;ArrayDeque&lt;Vector_t&gt;&gt;&gt;(
        6);

for (int i = 0; i &lt; 6; ++i) {
    mData.add(i, new Vector&lt;ArrayDeque&lt;Vector_t&gt;&gt;());
    // mData.get(i).setSize(200);
}

for (int i = 0; i &lt; 6; i++) {
    for (int k = 0; k &lt; 200; k++) {
        mData.get(i).add(new ArrayDeque&lt;Vector_t&gt;());
        mData.get(i).get(k).add(new Vector_t());
    }
}
</code></pre>

<p>where Vector_t is:</p>

<pre><code>class Vector_t {
    float x;
    float y;
    float z;
}
</code></pre>

<p>Is this initialization correct? When adding values to the array deque at the last position, it replaces the whole arraydeque with the last element, and I have no idea why.</p>

<p>Also, when I changing values using the code <code>mdata.get(1).get(42)</code> the element at <code>mdata.get(0).get(40)</code> is also affected. Again, I have no idea why?</p>

<p>I have given hardcoded values for example..this is the way i m adding</p>

<pre><code>if (mData.get(dir.value).get(slice).size() &gt;= sMaxNum_c)
     {
                 mData.get(dir.value).get(slice).removeFirst();
     }
              mData.get(dir.value).get(slice).addLast(result.acc);
</code></pre>

<p>when adding values to one direction other direction values are changing...:(</p>

<p>Please help me to solve this.</p>
