This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi all, I was wondering which is the best way of iterating through a hashmap. I cannot use iterator as it isn't define for HashMap. Should I cast the hashMap to some other data structure and iterate through that.
Take a look at Section 12.3 of David J. Eck's Introduction to Programming Using Java. About a third of the way down the page is the "Views, SubSets, and SubMaps" section that discusses iterating through all of the associations in a Map.