commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <>
Subject Re: [collections] InvokerClosure
Date Fri, 03 Dec 2004 00:32:42 GMT
Eric Pugh wrote:

> Things like this are cool..  But..  within the context of java, they just
> seem more difficult to read..  Requiring the user to know what an
> InvokerClosure is and does.  It's neat..  I just haven't seen the use case
> that requires it...

Well the code is still readable imho, it reads almost naturally "for all 
elements in the collection invoke the clearProperty method". I 
personnally like the "do the same thing in one line" aspect, but I admit 
the syntax is surprising, that's what makes it cool I guess ;)

An alternative for reducing the code is the new foreach syntax, for this 
specific example it's certainly more readable than a closure :

for (Configuration config : configList)

That makes me think, couldn't we use the Java 1.5 syntax while producing 
Java 1.3 compatible byte code ?

Emmanuel Bourg

View raw message