didn't need much RTFM to figure out how to
map println onto a list , but haven't yet
figured out how to map a composite function onto
a list. Can someone show how to do the equivalent
of this perl code?:
print g($_), "\n";
I'm still quite new to functionalj and have a lot
more to digest, looks like the
"verbosity-savings" may get lost when having
to modify functions with addParameter() etc. ????
Here is an example of using a composed function:
public class Example
public static void main(String p_args)
List list = Arrays.asList(1, 2, 3, 4);
Function f = new InstanceFunction(System.out, "println");
Function g = new StaticFunction(Example.class, "addFive");
Function h = new ComposedFunction(f, g);
public static int addFive(int p_int)
return p_int + 5;
This will print out
As for using addParameter(), you can also specify the parameters to the function at construction time instead.
Hope this helps,
Log in to post a comment.