当前位置:网站首页>Collections multiple parameter sorting
Collections multiple parameter sorting
2022-04-23 06:08:00 【linsa_ pursuer】
Sort by job number and time
package com;
import java.util.*;
public class Main {
public static void main(String[] args){
List<ConfigVO> list = new ArrayList<ConfigVO>();
ConfigVO a1 = new ConfigVO();
a1.setEmployeeNumber("1");
a1.setActualCheckInTime("2020-05-23");
ConfigVO a2 = new ConfigVO();
a2.setEmployeeNumber("2");
a2.setActualCheckInTime("2020-04-23");
ConfigVO a3 = new ConfigVO();
a3.setEmployeeNumber("1");
a3.setActualCheckInTime("2020-03-23");
ConfigVO a4 = new ConfigVO();
a4.setEmployeeNumber("2");
a4.setActualCheckInTime("2020-06-23");
list.add(a1);list.add(a2);list.add(a3);list.add(a4);
Collections.sort(list,new Comparator<ConfigVO>() {
public int compare(ConfigVO o1,ConfigVO o2) {
if(o1.getEmployeeNumber().equals(o2.getEmployeeNumber())){
return o1.getActualCheckInTime().compareTo(o2.getActualCheckInTime());
}else{
return o1.getEmployeeNumber().compareTo(o2.getEmployeeNumber());
}
}
});
System.out.println(list.toString());
}
}
package com;
public class ConfigVO {
public String employeeNumber;
public String actualCheckInTime;
public String getEmployeeNumber() {
return employeeNumber;
}
public void setEmployeeNumber(String employeeNumber) {
this.employeeNumber = employeeNumber;
}
public String getActualCheckInTime() {
return actualCheckInTime;
}
public void setActualCheckInTime(String actualCheckInTime) {
this.actualCheckInTime = actualCheckInTime;
}
@Override
public String toString() {
return "ConfigVO{" +
"employeeNumber='" + employeeNumber + '\'' +
", actualCheckInTime='" + actualCheckInTime + '\'' +
'}';
}
}
版权声明
本文为[linsa_ pursuer]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220533259519.html
边栏推荐
- Best practices for MySQL storage time
- Automatic control (Han min version)
- Pytorch学习记录(三):神经网络的结构+使用Sequential、Module定义模型
- 深入理解去噪论文——FFDNet和CBDNet中noise level与噪声方差之间的关系探索
- Opensips (1) -- detailed process of installing opensips
- Numpy common function table sorting of data processing
- Illustrate the significance of hashcode
- 治療TensorFlow後遺症——簡單例子記錄torch.utils.data.dataset.Dataset重寫時的圖片維度問題
- Fact final variable and final variable
- Exception handling: grab and throw model
猜你喜欢

Delete and truncate

Pyqy5 learning (2): qmainwindow + QWidget + qlabel

Framework analysis 1 Introduction to system architecture
![如何利用对比学习做无监督——[CVPR22]Deraining&[ECCV20]Image Translation](/img/33/780b80693f70112eebc10941f7c134.png)
如何利用对比学习做无监督——[CVPR22]Deraining&[ECCV20]Image Translation

On traversal of binary tree

数字图像处理基础(冈萨雷斯)二:灰度变换与空间滤波

Font shape `OMX/cmex/m/n‘ in size <10.53937> not available (Font) size <10.95> substituted.

In depth source code analysis servlet first program

图解numpy数组矩阵

You cannot access this shared folder because your organization's security policy prevents unauthenticated guests from accessing it
随机推荐
线性代数第三章-矩阵的初等变换与线性方程组
深入理解去噪论文——FFDNet和CBDNet中noise level与噪声方差之间的关系探索
Reading of denoising paper - [ridnet, iccv19] real image denoising with feature attention
SQL injection
Delete and truncate
Exception handling: grab and throw model
Problems and solutions of database migration
Pytorch学习记录(七):处理数据和训练模型的技巧
Pytorch学习记录(十三):循环神经网络((Recurrent Neural Network)
Custom exception class
Illustrate the significance of hashcode
Pytorch learning record (XI): data enhancement, torchvision Explanation of various functions of transforms
Latex快速入门
Pytoch -- data loading and processing
PyQy5学习(三):QLineEdit+QTextEdit
如何利用对比学习做无监督——[CVPR22]Deraining&[ECCV20]Image Translation
Chapter 4 of line generation - linear correlation of vector systems
How to grow at work
Automatic control (Han min version)
PyQy5学习(四):QAbstractButton+QRadioButton+QCheckBox