mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-22 16:23:50 +00:00
add "indices" cache in pagination with reversed functionality
This commit is contained in:
parent
7e0e520f03
commit
72f2fe3cc3
@ -38,7 +38,7 @@ fun <T> List<T>.paginate(with: Pagination, reversed: Boolean): PaginationResult<
|
|||||||
size,
|
size,
|
||||||
reversed
|
reversed
|
||||||
)
|
)
|
||||||
|
val indices = indices
|
||||||
val firstIndex = actualPagination.firstIndex.coerceIn(indices)
|
val firstIndex = actualPagination.firstIndex.coerceIn(indices)
|
||||||
val lastIndex = actualPagination.lastIndex.coerceIn(indices) + 1 // up to size
|
val lastIndex = actualPagination.lastIndex.coerceIn(indices) + 1 // up to size
|
||||||
if (firstIndex > lastIndex) {
|
if (firstIndex > lastIndex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user