Note that there are some explanatory texts on larger screens.

plurals
  1. POList<Arraylist<T>>> changes multiple entrys
    primarykey
    data
    text
    <p>I have a <code>List&lt;ArrayList &lt;T&gt;&gt;</code> called <code>arraylist</code> and for example I want to change just</p> <pre><code>arraylist.get(4).get(6) </code></pre> <p>by</p> <pre><code>arraylist.get(4).get(6).setName(), </code></pre> <p>it also changes </p> <pre><code>arraylist.get(0).get(6), arraylist.get(1).get(6), arraylist.get(2).get(6), arraylist.get(3).get(6). </code></pre> <p>What can I do to avoid this mistake? I need a list of <code>arraylist</code> because it will be the data for a dynamically generated Adapter for a <code>listview</code>.</p> <p>Has it something to do with <a href="https://stackoverflow.com/questions/7787531/arraylists-setting-a-value-on-one-arraylist-changes-a-value-on-another">this question</a>?</p> <p>Regarding it's(of the link/question above) solution: I can't create the <code>ArrayList&lt;T&gt;</code> from scratch, because I don't know how many there are going to be. (it will be calculated at runtime) </p> <p><strong>Edit:</strong></p> <p>Thanks for your comments yet and i'm sorry I'm new at Stackoverflow:</p> <ol> <li><p>It's Android</p></li> <li><p>what is supposed to happen: I have a List of ArrayLists of <code>&lt;T&gt;</code> (i need it because it gives dynamically the data for an ListView Adapter) and i just want to change one entry of one ArrayList for example the 6th entry of the 4th ArrayList</p></li> <li><p>But what happens is: It changes also the 6th entry of the 1st ArrayList, the 6th entry of the 2nd ArrayList and the 6th entry of the 3rd ArrayList.</p></li> </ol>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload