Quick question:
I have seen in bits of code in the past where code could call count () on an object that implements Iterator, for custom Iterator classes.
I wrote a class that implements Iterator and works fine in the foreach loop, but I'm just wondering if there is an extra class that I had to extend, or functions that I had to implement, so that the count () function worked on my class to return the value I want.
source share