当前位置:网站首页>List collection implements paging
List collection implements paging
2022-06-29 06:52:00 【seven billion two hundred and fifty-eight million two hundred a】
List Collection implementation paging
public class ListPage {
public static void main(String[] args) {
List<String> list = new ArrayList<>();
list.add("java");
list.add("python");
list.add("go");
list.add("C");
list.add("C++");
list.add("VUE");
int page = 2;
int size = 3;
list.forEach(
a -> System.out.print(a + "\t")
);
System.out.println();
List<String> pageList = handlePageList(list, page, size);
pageList.forEach(
b -> System.out.print(b + "\t")
);
}
private static List<String> handlePageList(List<String> list, Integer currentPage, Integer pageSize) {
List<String> currentPageList = new ArrayList<>();
if (list != null && list.size() > 0) {
int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
for (int i = 0; i < pageSize && i < list.size() - currIdx; i++) {
String wordFrequencyDTO = list.get(currIdx + i);
currentPageList.add(wordFrequencyDTO);
}
}
return currentPageList;
}
}
This article is for study and exchange only , Deletion of infringement contact .
边栏推荐
- Linux Installation redis
- Multithreading tool class completabilefuture
- Fault: ntfrs warning log for id13562
- Unity AR Shadow 阴影
- How to combine two byte arrays [repeat] - how to combine two byte arrays [duplicate]
- Creating a new generation of production and service tools with robot education
- json tobean
- JDBC连接数据库,socket发送客户端。
- package. Are you familiar with all configuration items and their usage of JSON
- How to change the password after forgetting the MySQL password (the latest version of 2022 detailed tutorial nanny level)
猜你喜欢

Fault: KDC warning log for id29

Chapter IV introduction to FPGA development platform

Annual inventory review of Alibaba cloud's observable practices in 2021

Redistemplate handles hash integer type problem resolution

package. Are you familiar with all configuration items and their usage of JSON

idea使用

Service grid ASM year end summary: how do end users use the service grid?

Teach you how to develop your own NPM package (publish to the NPM official website)

jetson tx2

2022.02.15 - SX10-31. House raiding III
随机推荐
[MySQL technology topic] technical analysis and guide for analyzing the high availability architecture of MySQL
IDEA常用插件
Venn diagram proportional and color shading with semi transparency
List集合实现分页
VerilogA - counter
Subtotal of C language -- basic data types and their representations
百度小程序自动提交搜索
Games101 Lecture 10 geometry 1 Notes
Some high-level usage of localstorage
Aging design guide for applets
C language pointer to function
力扣每日一题-第30天-594.最长和谐子序列
[Flink] flinksql and table programming cases
二叉树的迭代法前序遍历的两种方法
package. Are you familiar with all configuration items and their usage of JSON
2022.02.15
What is 'EC2-Other' filter in 'Cost Explorer' dashboard mean? [closed]
Service grid ASM year end summary: how do end users use the service grid?
What should I learn before learning programming?
How does schedulerx help users solve distributed task scheduling problems?