In the JDK, only a couple classes directly implement Iterable: Path,
DirectoryStream, and Collection. DirectoryStream has a note that it doesn't
support calling iterator() more than once, so I guess this is a
possibility. I'll change it back to Collection.
On 6 January 2017 at 22:52, Matt Sicker
Map doesn't implement collection. And the Iterator::hasNext is called on a
new Iterator obtained from the Iterable. It was implemented as a Collection
before, but I had a thought and implemented it as such. The javadocs for
Iterable don't exactly state whether or not the Iterator is a singleton,
bu
Instead of Map::isEmpty, we could do Collection::isEmpty. Also is it a good
idea to call Iterator::hasNext? In some implementations calling this method
moves the cursor one position forward. Do we actually need to check that an
Iterator is empty anywhere?
Sent from my iPhone
> On Jan 7, 2017,