Java 8: Melhorias de inferência de tipo genérico
ComJEP 101: Inferência de tipo de alvo generalizada, isto
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());
deve ser redutível para
final List<Boolean> bools = Arrays.asList(true, false, true);
final List<Character> string = bools.stream()
.map(x -> x ? 'X' : 'O')
.collect(Collectors.toList());
no Java 8, mas o último não compila:
Type mismatch: cannot convert from List<Object> to List<Character>
Eu entendi errado? Ou estou à frente das minhas ferramentas?
estou usandoJDK 8 build b120 junto comeclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT.zip.