|
|
@@ -28,11 +28,16 @@ public class PagingUtils { |
|
|
|
int startIndex = (pageNum - 1) * pageSize; |
|
|
|
int endIndex = Math.min(startIndex + pageSize, fullList.size()); |
|
|
|
|
|
|
|
// Ensure we don't go out of bounds |
|
|
|
// If startIndex is beyond the fullList size, return the remaining records |
|
|
|
if (startIndex < fullList.size()) { |
|
|
|
return fullList.subList(startIndex, endIndex); |
|
|
|
} else { |
|
|
|
return Collections.emptyList(); // Return empty list if start index is out of bounds |
|
|
|
// If there are records available, return the remaining records |
|
|
|
if (!fullList.isEmpty()) { |
|
|
|
return fullList.subList(fullList.size() - Math.min(pageSize, fullList.size()), fullList.size()); |
|
|
|
} else { |
|
|
|
return Collections.emptyList(); // Return empty list if fullList is empty |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |