Java 8: mejoras en la inferencia de tipos genéricos
ConJEP 101: Inferencia de tipo objetivo generalizada, esta
final List<Boolean> bools = Arrays.asList(true,false, true);
final List<Character> string = bools.stream()
.<Character>map(x -> x ? 'X' : 'O')
.collect(Collectors.<Character>toList());
debe ser reducible a
final List<Boolean> bools = Arrays.asList(true, false, true);
final List<Character> string = bools.stream()
.map(x -> x ? 'X' : 'O')
.collect(Collectors.toList());
en Java 8, pero este último no compila:
Type mismatch: cannot convert from List<Object> to List<Character>
¿Lo he entendido mal? ¿O estoy delante de mis herramientas?
estoy usandoJDK 8 build b120 Juntos coneclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT.zip.