commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rodney Waldhoff <>
Subject [functor] changes to EachElement
Date Sat, 19 Jul 2003 22:14:02 GMT
I've just checked in a somewhat significant change to the implementation,
but not the functionality, of EachElement.  Let me describe it for

Previously EachElement was an instantiable class implementing Generator,
but all the non-static methods simply delegating to some underlying
Generator instance (typically IteratorToGeneratorAdapter).  In other
words, EachElement was nothing more than a proxy/decorator for some other
Generator instance.

The other part of EachElement (that is, the static part) provided
"factory" methods for creating EachElement instances, e.g.,

Since the instantiable EachElement instance didn't seem to be adding any
value, I've removed it.  Now EachElement is just a container for the
static factory methods (the "from" methods).

Also, I made those factory methods handle null values a bit more robustly,
so that EachElement.from(null) return null, and added tests for this

What we've lost, relative to the previous revision of EachElement is:

1) the ability to write something like "new EachElement(someCollection)",
instead one must write "EachElement.from(someCollection)", or if you
really like "new", then "new

2) the ability to write something like "new EachElement(generator)", or
even "EachElement.from(generator)".  It's not clear to me why that was
provided in the first place.  new EachElement(generator) simply creates an
equivalent Generator, but with an extra level of indirection.

If someone is strongly opposed to these changes we can always roll back to
the previous revision.

- Rod <>

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message