当前位置:网站首页>List分页方法
List分页方法
2022-07-21 19:49:00 【java-zh】
public static List<?> page(List<?> dataList, int pageSize, int pageNum) {
List<Object> pageList = new ArrayList<>();
if (dataList != null && dataList.size() > 0) {
int total = (pageNum > 1 ? (pageNum - 1) * pageSize : 0);
for (int i = 0; i < pageSize && i < dataList.size() - total; i++) {
Object data = dataList.get(total + i);
pageList.add(data);
}
}
return pageList;
}
边栏推荐
- MATLAB 自然样条函数(约束两端斜率)
- Urlparrern configuration
- Summary of some experiences in the process of R & D platform splitting
- Eolink ——通过文档驱动,快速开发接口
- Idea 2022.2 was officially released, and I can't keep up with it!
- How to do the interface test in JSON format?
- MongoDB的基本操作介绍、数据库/表的创建和删除、数据的查询
- Analyze a ros2 cmakelists in detail Txt file
- 面试难题:分布式 Session 实现难点,这篇就够!
- Which is the best interface documentation tool at home and abroad?
猜你喜欢
企业源代码防泄密工作该如何开展
Why should host reinforcement be done in industrial control industry
The most complete summary of MySQL data types in history - (first)
微信小程序开发学习6(基础加强之使用npm包和全局数据共享及分包【Tab底栏案例改进】)
Weekly recommended short video: what is the difference between IOT development and embedded development?
Summary of the most complete MySQL data types in history (Part 2)
leetcode 92. Reverse Linked List II(链表逆序II)
一套简单的进销存管理系统源码
MongoDB的基本操作介绍、数据库/表的创建和删除、数据的查询
微信小程序开发流程
随机推荐
How to choose the appropriate data type for fields in MySQL?
利用西门子低代码实现企业质量管理流程的敏捷性
Energy principle and variational method note 10: virtual displacement principle
通达信上开户安全吗?
2022 音视频技术风向标
Response响应字节数据
Halcon知识:用分箱实现OCR分类器
Request and response description
Dota2参议院[贪心与队列]
计网--网络层
IDEA 2022.2 正式发布,骚操作,跟不上了!
Servlet Chapter 1
mysql中的四大运算符种类汇总20多项,用了三天三夜来整理的,还不赶快收藏
Leetcode skimming: dynamic planning 02 (climbing stairs)
Seven best ways to get out of the psychological comfort zone
如何使用文档工具进行 API 管理?
Kingbasees Security Guide for Jincang database -- 3.1 user management
普罗米修斯Prometheus+Grafana,监控搭建与界面基础配置
详细分析一个ROS2 CMakeLists.txt文件
C # implement setting expiration time for PDF documents