Given doSomething(Function foo) { println foo(2) }
Groovy: doSomething( { it*it } as Function )
Java: doSomething( (x) -> x*x
{() -> new MyObject();}
it can be written as MyObject::new
. I think not all lambda expressions can be represented by using Method References. I dont think it would be ideal to compare the lambda expression support in Java 8 with that of more mature Groovy or Scala support. This is the first step for Java to introduce lambda expressions so going forward we can expect to have more mature support for lambda expressions.