当前位置:网站首页>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
边栏推荐
- Reading of denoising paper - [ridnet, iccv19] real image denoising with feature attention
- Complete example demonstration of creating table to page - joint table query
- 如何利用对比学习做无监督——[CVPR22]Deraining&[ECCV20]Image Translation
- JDBC operation transaction
- IO multiplexing of 09 redis
- The official website of UMI yarn create @ umijs / UMI app reports an error: the syntax of file name, directory name or volume label is incorrect
- 治疗TensorFlow后遗症——简单例子记录torch.utils.data.dataset.Dataset重写时的图片维度问题
- 线性代数第三章-矩阵的初等变换与线性方程组
- Anaconda
- Pytorch Learning record (XIII): Recurrent Neural Network
猜你喜欢
Gaussian processes of sklearn
Create binary tree
Pytorch learning record (XII): learning rate attenuation + regularization
CONDA virtual environment management (create, delete, clone, rename, export and import)
Why does the subscript of the array start from 0 instead of 1?
LDCT图像重建论文——Eformer: Edge Enhancement based Transformer for Medical Image Denoising
Pytorch学习记录(十一):数据增强、torchvision.transforms各函数讲解
Filebrowser realizes private network disk
Multithreading and high concurrency (1) -- basic knowledge of threads (implementation, common methods, state)
RPC must know and know
随机推荐
Unsupervised denoising - [tmi2022] ISCL: dependent self cooperative learning for unpaired image denoising
umi官网yarn create @umijs/umi-app 报错:文件名、目录名或卷标语法不正确
Programming record - picture rotation function SciPy ndimage. Simple use and effect observation of rotate()
Get the value of state in effects in DVA
Framework analysis 2 Source code - login authentication
自動控制(韓敏版)
Pyqy5 learning (2): qmainwindow + QWidget + qlabel
Pytorch学习记录(三):神经网络的结构+使用Sequential、Module定义模型
Latex quick start
编写一个自己的 RedisTemplate
2. Devops sonar installation
Exception handling: grab and throw model
Paper on LDCT image reconstruction: edge enhancement based transformer for medical image denoising
Solve the error: importerror: iprogress not found Please update jupyter and ipywidgets
Viewer: introduce MySQL date function
RedHat realizes keyword search in specific text types under the directory and keyword search under VIM mode
Common programming records - parser = argparse ArgumentParser()
JDBC connection database
Opensips (1) -- detailed process of installing opensips
1. Calculate a + B