Java Lambda
February 8, 2013 Leave a comment
I have only lean pickings especially during this recession. But this is my first Java Lambda. I have worked with Clojure in the past and I can relate to that.
There is enormous power in lambda’s and I hope to explore it further.
package com.test.lambda;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.FutureTask;
public class Lambda {
/* @param args*/
public static void main(String[] args) {
Runnable r = () -> System.out.println("Test Lambda");
ExecutorService executor = Executors.newFixedThreadPool(2);
executor.execute(r);
executor.shutdown();
}
}
Compiled with
openjdk version “1.8.0-ea”
OpenJDK Runtime Environment (build 1.8.0-ea-lambda-nightly-h3207-20130205-b76-b00)
OpenJDK 64-Bit Server VM (build 25.0-b15, mixed mode)