Hi,

So the question is do we really need SingletonIterator and such. If we want to eliminate the number of methods or classes, then what about one class for all of collections or iterators? I suppose the use of singleton methods and classes is almost always to provide an object matching a data type you want. Thus, we can have a class like

class Singleton implements List, SortedSet, Bag, Iterator, ListIterator {
}


Although it is usually bad practice to aggregate several different functionalities into one class, in this case, it might be fine.

Yes, this is in line with your proposal; we can use SingletonListIterator for both Iterator and ListIterator. I think the problem of this solution is users probably expect SingletonIterator intuitively and might be puzzled why there is no such.

Takuya Murata


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to