I remember reading it awhile ago, and upon rereading it I'm still left
seeing the same problem, all of those closures just have a single
statement:

public int countFileLines(String fileName) {
    lineCounter = 0;
    Closure1<String> lineReader = closure(String.class); {
of(this).countNonEmptyLine(var(String.class)); }
    readFileByLine(fileName, lineReader);
    return lineCounter;
}


I'm not sure -how- you're pulling this off, and it sure looks like an
impressive as hell trick, but if I wanted this closure to do multiple
operations I don't see it, I assume if I had multiple of(this)
statements only the first would get associated with the closure()
definition?

I suspect if closure() was called something like "methodPointer()" it
would sit better with me, as (as far as I can tell), the intended
usage is more of that of an invokable pointer to a declared method,
and not short inline block of code (what I'd normally expect in a
closures system).

Would it be possible to just do:

public int countFileLines(String fileName) {
    lineCounter = 0;
    readFileByLine(fileName, of(this).countNonEmptyLine(var(String.class)));
    return lineCounter;
}

and just use the of() declaration?


-- 
Pull me down under...

On Sun, Nov 22, 2009 at 10:53 AM, Mario Fusco <mario.fu...@gmail.com> wrote:
> id you give a look at this?
>
> http://code.google.com/p/lambdaj/wiki/Closures

--

You received this message because you are subscribed to the Google Groups "The 
Java Posse" group.
To post to this group, send email to javapo...@googlegroups.com.
To unsubscribe from this group, send email to 
javaposse+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/javaposse?hl=.


Reply via email to