I'm trying to use lambdas and streams in java but I'm quite new to it.
I got this error in IntelliJ "target type of lambda conversion must be an interface" when I try to make a lambda expression
List> callList = prgll.stream()
.map(p->(()->{return p.funct();} ))
.collect(Collectors.toList());
Am I doing something wrong?
解决方案
I suspect it's just Java's type inference not being quite smart enough. Try
.map(p -> (Callable) () -> p.funct())