While this is a good question, it's not the actual problem I'm trying to
point out. SingletonIterator or singletonIterator() is a redundant method
in 99% of its usage. Only if someone has if(instanceof ListIterator) {.. }
else if(instanceof Iterator) would it change the funcationality.
Using XxxUtils [which is what java.util.Collections effectively is in
Commons language] as factories is something we've considered moving
towards for a while.
The biggest problem is that you end up with large XxxUtils classes [or
XxxFactory, whatever] which are hard to understand and comprehend.
However, a widely spread API with lots of classes is also hard to
understand and comprehend. Maybe there's a magic ratio of classes to
methods? :)
Anyway, I'm always +1 to a good standard feel to the Collections.
Currently I'm trying to ensure I understand what every class in
Collections does and for some it is a bit hard to comprehend with the
current documentation.
Hen
On Wed, 20 Aug 2003, Takuya Murata wrote:
> Hello,
>
> > Firstly, SingletonIterator and SingletonListIterator seem quite
> > similar.
> > Apart from the extra type of 'ListIterator', it appears that a
> > SingletonListIterator can do the job of a SingletonIterator in all
> > jobs.
> > Could just remove SingleIterator.
>
> I was thinking can we eliminate those classes by methods returning
> interface? It is always a good practice to use interface rather than
> specifying concrete class. I mean just like singleton method of
> java.util.Collections
>
> Code should be like:
>
> class Collections2 {
> public ResetableIterator singletonIterator () { ... }
> public ResetableListIterator singletonIterator () { ... }
> }
>
> It is possible to use just one concrete class for both methods above.
>
> Given there is a few discussion of code review, I think every one is
> busy maintaining the existing code base.
>
> Takuya Murata
> [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]