This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Why does HashSet implement Iterable?
HashSet is not ordered and a comparator object refers to the ordered collections - to iterate means to go through a collection / an array in ordered way. So what's up with HashSet?
HashMap is not directly iterable, but it does provide methods such as keySet() and entrySet() which return Set objects that are iterable. There's also values(), which returns a collection of the values in the map (which is also iterable).
The designers of interface java.util.Map could have chosen to make it extend Iterable<Map.Entry<K, V>>, so that you could directly iterate over the map's entries. But they didn't do that.