1, to the two list (including other similar containers), if you add an element to the inside (reference data type), then this list is stored in the object's reference;
If you want to avoid this phenomenon can be: In addition to the new element without direct pressure, the existing objects copied a copy of the press in (I recommend if you write the class is best to implement the Cloneable interface, overload the Clone function);
2. These two guys are not allowed to traverse:
for (LinkedList ele:elelist) visit ele;
When you delete more than one element, it will throw an exception, of course, if you can guarantee a loop down to remove only one element, and remove the direct jump out of the loop is no problem. Now provides a way to solve the first situation: at the time of the traversal of all the elements to be deleted into a temporary container (temp_container), and so on after the traversal of the call RemoveAll (Temp_container) is done.
ARRAYLIST,LINKEDLISTD and other containers when using the attention point: