Checking in AllItemsID REST endpoint and relevant changes

Checking in AllItemsID REST endpoint and relevant changes
I'm wondering if it's possible to avoid copying the value into a collection. There could be millions. In the abstract, there's no need to copy them in order to write them out to the response -- you do just need to iterate over them. But I am not sure whether there is a way to get the framework to work with an Iterable or Iterator?