Java 8: ogólne ulepszenia wnioskowania typu
ZJEP 101: Uogólnione wnioskowanie typu celu, to
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());
powinien być redukowany do
final List<Boolean> bools = Arrays.asList(true, false, true);
final List<Character> string = bools.stream()
.map(x -> x ? 'X' : 'O')
.collect(Collectors.toList());
w Javie 8, ale ten drugi nie kompiluje:
Type mismatch: cannot convert from List<Object> to List<Character>
Czy źle to zrobiłem? A może wyprzedzam moje narzędzia?
ja używamJDK 8 build b120 razem zeclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT.zip.