Closed pedrodaviddev closed 7 years ago
I think you have made a grave mistake @Nhemesy. Yours iterators wraps a real list without remove the link reference with the list from constructor.
Normally a iterator create a list clone that receives from constructor to for example remove while iterates in list, or something like that.
Also I think that maybe this is irrelevant for the design pattern 🤔 but it is a good improvement.
Implemented iterator:
NormalIterator
is a basic example for iterator. This is what I just implemented.RandomIterator
andBackwardsIterator
are two useful uses for Iterator. I thought that could be interesting to show more implementations of Iterator, to show the real power of Iterator!