This week's book giveaway is in the Agile and other Processes forum. We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line! See this thread for details.
HashMap does indeed store its keys in a seemingly random order. It's not really random, of course -- the order is related to the hashCode() values of the keys -- but it's not any kind of useful sorted order.
If you want a map in which they keys are kept in sorted order, use java.util.TreeMap instead. You pay for that sorting by giving up a little performance, but in many circumstances this really doesn't matter.