Adds all of the elements in the specified collection to this collection (optional operation). The behavior of this operation is undefined if the specified collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified collection is this collection, and this collection is nonempty.)
That explains it?
Joined: Sep 10, 2009
Ahh..that might explain. Thanks a lot James.
What's surprising is the output changes with java versions. So with java version "1.4.2_14" the output is
whereas with java version 1.5 and higher, the output is:
I went into src.zip and the addAll method appears to be un-overridden from AbstractCollection, and here it is:So I looked up add in HashSet and found this:Can't see how you manage to double the contents of a Set like that. I altered the original class like thisand got this output