Hi folks, quick question. Why I can’t convert a se...
# announcements
a
Hi folks, quick question. Why I can’t convert a sequence into a java stream like this
Copy code
sequence {
   yieldAll(1..100 step 10)
}.asStream()
while in the <http://(https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.streams/kotlin.sequences.-sequence/as-stream.html|doc> it seems it’s possible? Intellij tells me
unresolved reference asStream()
d
Have you imported it?
a
intellij doesn’t give me the option 🙂 now sure from the doc what’s the namespace to import
d
import kotlin.streams.asStream
d
Streams are Java 8, this extension is only available in the jdk8 variant of the stdlib.
Unfortunately the Icon that signifies this in the docs is tiny 😄
a
yeah I’m using java 11 so I should be fine. I actually see why intellij is not recognizing it. If I add the import @Dominaezzz suggested,
streams
is marked red. Probably I need to add the lib 😕
d
kotlin("stdlib-jdk8")
a
thanks!