mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2026-10-29 08:03:05 +00:00
change order in iterable to skip changing of pagination on no left elements error
This commit is contained in:
1 parent
c25e3f5867
commit
e38094df58
1 file changed
+1
-1
+1
-1
@@ -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()
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user