S
Shawn
Hi,
In a precedual language world, a method can take a parameter which is a
method by itself. For example,
<psudo-code>
sum_from_a_to_b(myFunc, a, b); //a is 1, b is 5
by passing different myFunc,
sum_from_a_to_b=1+2+3+4+5;
or
sum_from_a_to_b=1^2+2^2+3^2+4^2+5^2;
or
sum_from_a_to_b=1^3+2^3+3^3+4^3+4^3;
or
sum_from_a_to_b=(1+50)^2+(2+50)^2+...+(5+50)^2;
or
anything you specified in myFunc.
This strategy is very powerful because it elevated one level higher by
abstraction. Can Java do something similar? If not, how Java get around it?
Thank you very much. I greatly appreciate any feedback.
In a precedual language world, a method can take a parameter which is a
method by itself. For example,
<psudo-code>
sum_from_a_to_b(myFunc, a, b); //a is 1, b is 5
by passing different myFunc,
sum_from_a_to_b=1+2+3+4+5;
or
sum_from_a_to_b=1^2+2^2+3^2+4^2+5^2;
or
sum_from_a_to_b=1^3+2^3+3^3+4^3+4^3;
or
sum_from_a_to_b=(1+50)^2+(2+50)^2+...+(5+50)^2;
or
anything you specified in myFunc.
This strategy is very powerful because it elevated one level higher by
abstraction. Can Java do something similar? If not, how Java get around it?
Thank you very much. I greatly appreciate any feedback.