commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andy Kriger <>
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.


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

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


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.


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

View raw message