// 获取最大ID值
int maxId = 0;
for (Project project : projectList) {
int projectId = Integer.parseInt(project.getId());
maxId = projectId > maxId ? projectId : maxId;
}
// 获取最小ID值
int minId = 0;
for (Project project : projectList) {
int projectId = Integer.parseInt(project.getId());
minId = projectId < minId ? projectId : minId ;
}
Java获取最大值和最小值
最新推荐文章于 2024-09-23 22:25:50 发布