add "indices" cache in pagination with reversed functionality

This commit is contained in:
InsanusMokrassar 2024-05-26 23:01:23 +06:00
parent 7e0e520f03
commit 72f2fe3cc3

View File

@ -38,7 +38,7 @@ fun <T> List<T>.paginate(with: Pagination, reversed: Boolean): PaginationResult<
size,
reversed
)
val indices = indices
val firstIndex = actualPagination.firstIndex.coerceIn(indices)
val lastIndex = actualPagination.lastIndex.coerceIn(indices) + 1 // up to size
if (firstIndex > lastIndex) {