This method is written as if you wanted to make debugging harder. Here code modifies internal structure instead of collecting elements at first and then storing them. For correct work it needs clearing elements. And isn't evident in what order the collected elements will be stored. Anyway it must be dropped...