Function Objects in in Java

This blog entry is really just a support entry for a YouTube movie I created today.
A few weeks ago, I taught a course on plain old Java… The students had LISP background and raised the questions:
Does Java have Closures?

Well, it doesn't really have direct support for closures directly, but we can achieve most of the design advantages that closures provide. In this short demo, I show how one may implement closures in Java.

Code Listing

Here is the final code listing for what I showed in the demo.

ClosureDemo.java

Function.java

SquareFunction.java

EchoFunction.java

No Comments Yet.

Leave a comment