I'm wondering how this code could be improved. I especially don't like the use of mutable Buffer but not sure what the best way to get it out cleanly.      def find(service: Service): Traversable[Long] = {    def loop(lastId: Option[Long])            (acc: mutable.Buffer[Long])            (quota: Int): Traversable[Long] = {      val response = service.call(lastId.getOrElse(-1))      if (response.size() > 0 && quota > 0) {        loop(response.last.getId)(acc ++ response)(quota - 1)      } else {        (acc ++ response).toList      }    }    loop(None)(mutable.Buffer())(3)  }
Gathering response from a pagable service
scala