Hi. Are we supposed to be able to return a kotlin ...
# spring
n
Hi. Are we supposed to be able to return a kotlin Sequence from a spring-data query? Not finding much on Google...
r
I think the closest you'd get is returning a Kotlin Flow. If the method returns a
Flux<T>
normally, you can convert it to a `Flow<T>`(there's usually an
.asFlow()
helper method).
j
If you can get a spring data method to return a java 8 stream, there's an extension method
asSequence
that can easily get you a sequence
n
Great thanks. I think Flux is for reactive/webflux mode which I'm not using but yes it can return Stream so .asSequence() should work, thanks!