Jilles Soeters
07/30/2021, 5:54 PMIterable<T>
and others List<T>
. I believe repositories return a List
of entites so why would anyone specify return type of Iterable
? e.g. https://github.com/spring-guides/tut-spring-boot-kotlin/blob/main/src/main/kotlin/com/example/blog/Repositories.kt#L7Emmett Miller
07/30/2021, 6:37 PMList
and other Collection
types require the entire result set to be loaded into memory. An Iterable
doesn't necessarily enforce that. Whether you actually get any mileage out of that distinction is up to Spring's implementation. IIRC you can also return Stream
as well.