10.4 Higher Order Functions in Java
Higher Order Function: A function that treats another function as data.
e.g. takes a function as input.
Example in Python:
Higher Order Functions in Java 7
Old School (Java 7 and earlier)
Fundamental issue: Memory boxes (variables) cannot contain pointers to functions.
use an interface instead:
This code above is the same as the Python code:
Now, to finish the rest of the Python code in Java:
This code above is equivalent to the Python code provided earlier.
Last updated