There's no need for a Collections.iterator(Collection)
method, because the Collection
interface has an iterator()
method that returns an Iterator
already. It only makes sense when you have a Collection
already, and the Iterator
is coupled with the Collection
anyway. What would Collections.iterator(Collection c)
do? It would probably just call return c.iterator();
.
I suppose that Collections.emptyIterator()
and Collections.emptyListIterator()
save the caller the processing to create an empty Collection
/ List
just to call its iterator()
/ listIterator()
method.
The GRASP pattern "Information Expert" would indicate that the design of an Iterator
would be with the class it iterates, because the class itself has the information needed to create an Iterator
.