Citando il javadoc ufficiale del List.addAll
:
Appends all of the elements in the specified collection to the end of
this list, in the order that they are returned by the specified
collection's iterator (optional operation). The behavior of this
operation is undefined if the specified collection is modified while
the operation is in progress. (Note that this will occur if the
specified collection is this list, and it's nonempty.)
Così si copierà i riferimenti degli oggetti in list
a anotherList
. Qualsiasi metodo che non funziona sugli oggetti di riferimento di anotherList
(come rimozione, aggiunta, ordinamento) è locale e pertanto non influenza list
.
fonte
2012-06-30 10:52:21
Mente che ho respinto la domanda originale, perché le tue modifiche hanno perso l'intero punto della domanda stessa. –
Il problema è che questa non è più una domanda, e non ha alcun senso affatto) –
per favore questa domanda ha bisogno di essere modificata, non ha senso. – Ogbe