The following code compiles fine in IntelliJ and Eclipse, but the JDK compiler 1.8.0_25 complains. First, the code.
import java.util.function.Predicate;
public
super E>
includes Object
, which isn't a Boolean
. ie
MyPredicate super E>
Could be a
MyPredicate
and you can't return an Object
as a boolean
.
Try changing your lambda to:
MyStream. create().filter(b -> Boolean.TRUE.equals(b));
which will compile and execute without error not matter the type of the stream, but will return true
for elements that are true
Boolean
values.