使用JEP 101:广义目标类型推断,这
final Listbools = Arrays.asList(true,false, true); final List string = bools.stream() . map(x -> x ? 'X' : 'O') .collect(Collectors. toList());
应该可以减少
final Listbools = Arrays.asList(true, false, true); final List string = bools.stream() .map(x -> x ? 'X' : 'O') .collect(Collectors.toList());
在Java 8中,但后者不编译:
Type mismatch: cannot convert from List
我弄错了吗?还是我领先于我的工具?
我正在使用JDK 8 build b120和eclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT.zip.