mirror of
				https://github.com/InsanusMokrassar/MicroUtils.git
				synced 2025-11-04 06:00:22 +00:00 
			
		
		
		
	more fixes:)
This commit is contained in:
		@@ -21,7 +21,12 @@ fun <T> Iterable<T>.paginate(with: Pagination): PaginationResult<T> {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
fun <T> List<T>.paginate(with: Pagination): PaginationResult<T> {
 | 
			
		||||
    return subList(maxOf(with.firstIndex, 0), minOf(with.lastIndexExclusive, size)).createPaginationResult(
 | 
			
		||||
    val firstIndex = maxOf(with.firstIndex, 0)
 | 
			
		||||
    val lastIndex = minOf(with.lastIndexExclusive, size)
 | 
			
		||||
    if (firstIndex > lastIndex) {
 | 
			
		||||
        return emptyPaginationResult()
 | 
			
		||||
    }
 | 
			
		||||
    return subList(firstIndex, lastIndex).createPaginationResult(
 | 
			
		||||
        with,
 | 
			
		||||
        size.toLong()
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user