Skip to main content

Basic forEach not compiling

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2013-05-08

Does anyone know why this won't compile?

List numbers = Arrays.asList(1, 2, 3, 4, 5);
numbers.forEach(s -> { System.out.println(s); });

Error: error: cannot find symbol
numbers.forEach(s -> { System.out.println(s); });
symbol: method forEach((s)->{ Sys[...]s); })
location: variable numbers of type List
1 error


java version "1.8.0-ea"
Java(TM) SE Runtime Environment (build 1.8.0-ea-b86)