"unordered" just means that the order is not anything the programmer can rely on; it does not mean that the order will be random. For example, this kind of behavior could easily change from one JVM version to the next.
Joined: Oct 16, 2009
I did not understand , can you give me more explanation please.
Joined: Mar 22, 2005
You misunderstand what the term "unordered" means in this context. It does not mean that the list is not ordered; in fact, the list is likely to be ordered in some deterministic way. What it means is that the programmer using the class can't rely on the ordering.
If you're interested in what the class does underneath the API, then Sun's JDK comes with the source code in a file named "src.zip"; in it you'll find HashSet.java file which you examine as to how it arrives at the ordering you observed. But be advised that the details can change from one JRE version to the next, because the javadocs explicitly say that this behavior is not guaranteed.
Note that sets don't have an ordering to begin with (at least HashSet does not) - they're not Lists.