I got only one lot of output with Java6.
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 this
and got this output
campbell@queeg:~/java$ java TestSet
Type = java.lang.String, hash code = 30, value = 0
Type = java.lang.String, hash code = 31, value = 1
Type = java.lang.String, hash code = 32, value = 2
Type = java.lang.String, hash code = 33, value = 3
Type = java.lang.String, hash code = 34, value = 4
Not adding elements
3
2
1
0
4
campbell@queeg:~/java$
That is behaving as I would expect, using Java6u14.
Maybe somebody who is getting different outputs would like to try those alterations.