A HashMap won't preserve order.

A TreeMap preserves the order of its keys, in this case the String names. So using TreeMap doesn't really get you anything either, if you're trying to get the order...