commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Kriger <andy.kri...@gmail.com>
Subject [collections] Can Closures return values?
Date Wed, 25 May 2005 21:06:09 GMT
I have a loop common to several methods where the behavior of the loop
depends on the boolean result of different method calls.

ex)

do {
   if(x.equals(y)) do some stuff
} while(test)

do {
   if(x.startsWith(y)) do some stuff
} while(test)

etc

The looping and testing are a bit more complicated than that (e.g. big
nested loop). I'd like to use an invokerClosure to handle the test so
that I can have one common method that takes the Closure as an
argument. However, I don't see a way to get a return value from a
Closure. Is this possible? I could make the whole if/then block the
Closure.execute but if possible I'd like to know if the Closure is
able to return values.

thx
andy

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org


Mime
View raw message