Reputation: 7485
With JEP 101: Generalized Target-Type Inference, this
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());
should be reducable to
final List<Boolean> bools = Arrays.asList(true, false, true);
final List<Character> string = bools.stream()
.map(x -> x ? 'X' : 'O')
.collect(Collectors.toList());
in Java 8, but the latter does not compile:
Type mismatch: cannot convert from List<Object> to List<Character>
Have I got it wrong? Or am I ahead of my tools?
I am using JDK 8 build b120 together with eclipse-SDK-4.3.1-win32-x86_64-efx-0.9.0-SNAPSHOT.zip.
Upvotes: 9
Views: 3551
Reputation: 8178
The example is accepted by every Eclipse release since the release of Java 8.
(Releases greater or equal P20140317-1600).
Upvotes: 0
Reputation: 7485
Seems like this issue is fixed now with the latest JDT snapshot implementing the desired proposal.
Upvotes: 2
Reputation: 55
It just works fine under IntelliJ Idea 13 which seems ahead of Eclipse for Java8 support. So I guess you just have to wait until Eclipse will be able to compile this.
Upvotes: 2