Well that's exactly kotlin's problem :slightly_smi...
# announcements
Well that's exactly kotlin's problem 🙂 Since it is solved for Kt collections, why not in J8 streams support? Added another map to the end of the chain (seems silly to me, but works):
.map { it as SomeSpecificType }
czar: It’s definitely not a Kotlin problem. And actually not a problem at all. You can rewrite this code to java and will get exactly the same behavior:
Copy code
Stream.of(1, "two")
                .filter(it -> it instanceof String)
Return type of this steam is List<? extends Serializable>
Compiler cannot analyze code of filter to cast it implicitly, and actually should not do that