mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 08:13:49 +00:00
change order in iterable to skip changing of pagination on no left elements error
This commit is contained in:
parent
c25e3f5867
commit
e38094df58
@ -14,9 +14,9 @@ class PaginatedIterator<T>(
|
||||
override fun next(): T {
|
||||
if (currentStack.isEmpty()) {
|
||||
val resultPagination = paginationResultGetter.invoke(pagination)
|
||||
pagination = resultPagination.nextPage()
|
||||
currentStack.addAll(resultPagination.results)
|
||||
require(currentStack.isNotEmpty()) { "There is no elements left" }
|
||||
pagination = resultPagination.nextPage()
|
||||
}
|
||||
return currentStack.removeFirst()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user