posted 15 years ago
[Joanne]: If order is important use a LinkedHashMap
Or possibly a TreeMap. In this example they will both give the same output. But if you change
to
then the LinkedHashMap will iterate in the order the items were added (3-2-1) while the TreeMap will iterate in the natural order of the keys (1-2-3). Choose whichever behavior seems more appropriate for your application.
"I'm not back." - Bill Harding, Twister