Question about latest binary build
Marcus Thiesen
marcus at thiesen.org
Wed Jul 18 09:01:12 PDT 2012
Hello List,
I've got a quick question:
Why does:
public class TestSimple {
public static void main( final String... args ) {
new Thread( () -> System.out.println("Hello World");
).start();
}
}
Give:
TestSimple.java:6: error: ')' expected
new Thread( () -> System.out.println("Hello World"); ).start();
^
TestSimple.java:6: error: illegal start of expression
new Thread( () -> System.out.println("Hello World"); ).start();
^
TestSimple.java:6: error: illegal start of expression
new Thread( () -> System.out.println("Hello World"); ).start();
^
TestSimple.java:6: error: ';' expected
new Thread( () -> System.out.println("Hello World"); ).start();
^
4 errors
Whereas:
import java.util.*;
public class TestSimple2 {
public static void main( final String... args ) {
final List<String> testList = new ArrayList<String>();
final Iterable<Integer> intList = testList.map( e ->
Integer.valueOf( e ) );
}
}
compiles? I.e. the first example requires curly braces around the
lambda body and the other not?
Thanks,
Marcus
build 1.8.0-ea-lambda-nightly-h193-20120624-b45-b00
--
Marcus Thiesen :: www.thiesen.org :: @mthiesen :: 0173 / 28 01 82 4
More information about the lambda-dev
mailing list