当前位置:网站首页>Paging the list collection
Paging the list collection
2022-04-23 16:48:00 【A coir boat in the broken white clouds】
list Paging tools
/** * Start paging * @param list * @param pageNum Page number * @param pageSize How many pieces of data per page */
public static List startPage(List list, Integer pageNum, Integer pageSize) {
if (list == null) {
return null;
}
if (list.size() == 0) {
return null;
}
Integer count = list.size(); // Record the total number
Integer pageCount = 0; // the number of pages
if (count % pageSize == 0) {
pageCount = count / pageSize;
} else {
pageCount = count / pageSize + 1;
}
int fromIndex = 0; // Start index
int toIndex = 0; // End index
if (!pageNum.equals(pageCount)) {
fromIndex = (pageNum - 1) * pageSize;
toIndex = fromIndex + pageSize;
} else {
fromIndex = (pageNum - 1) * pageSize;
toIndex = count;
}
List pageList = list.subList(fromIndex, toIndex);
return pageList;
}
版权声明
本文为[A coir boat in the broken white clouds]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231400068418.html
边栏推荐
- Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed
- The solution of not displaying a whole line when the total value needs to be set to 0 in sail software
- 深度学习100例 | 第41天-卷积神经网络(CNN):UrbanSound8K音频分类(语音识别)
- Derivation of Σ GL perspective projection matrix
- The first line and the last two lines are frozen when paging
- UWA Pipeline 功能详解|可视化配置自动测试
- PyTorch:train模式与eval模式的那些坑
- 面试百分百问到的进程,你究竟了解多少
- Pycham connects to the remote server and realizes remote debugging
- Introduction to new functions of camtasia2022 software
猜你喜欢

Phpstudy V8, a commonly used software for station construction 1 graphic installation tutorial (Windows version) super detailed

DDT + Excel for interface test

Loggie source code analysis source file module backbone analysis

Nacos 详解,有点东西

Cartoon: what are IAAs, PAAS, SaaS?

File upload and download of robot framework

建站常用软件PhpStudy V8.1图文安装教程(Windows版)超详细

Set the color change of interlaced lines in cells in the sail software and the font becomes larger and red when the number is greater than 100

The first line and the last two lines are frozen when paging
![Knowledge points and examples of [seven input / output systems]](/img/5f/759a73836f79ef848f449930dcc1b1.png)
Knowledge points and examples of [seven input / output systems]
随机推荐
05 Lua 控制结构
[pimf] openharmony paper Club - what is the experience of wandering in ACM survey
[pyGame games] how did angry birds, a mobile game that became popular all over the world 10 years ago, dominate the list? Classic return
深度学习100例 | 第41天-卷积神经网络(CNN):UrbanSound8K音频分类(语音识别)
信息摘要、数字签名、数字证书、对称加密与非对称加密详解
Project framework of robot framework
The first line and the last two lines are frozen when paging
5分钟NLP:Text-To-Text Transfer Transformer (T5)统一的文本到文本任务模型
Use case execution of robot framework
聊一聊浏览器缓存控制
欣旺达:HEV和BEV超快充拳头产品大规模出货
NVIDIA graphics card driver error
Introduction notes to PHP zero Foundation (13): array related functions
Server log analysis tool (identify, extract, merge, and count exception information)
How much do you know about the process of the interview
蓝桥杯省一之路06——第十二届省赛真题第二场
NVIDIA显卡驱动报错
网络安全之渗透靶场实战详解
Sail soft calls the method of dynamic parameter transfer and sets parameters in the title
Detailed explanation of UWA pipeline function | visual configuration automatic test