当前位置:网站首页>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
边栏推荐
- EditorConfig
- C3p0 database connection pool usage
- 治疗TensorFlow后遗症——简单例子记录torch.utils.data.dataset.Dataset重写时的图片维度问题
- Exception handling: grab and throw model
- Common programming records - parser = argparse ArgumentParser()
- Programming record - picture rotation function SciPy ndimage. Simple use and effect observation of rotate()
- Rsync for file server backup
- Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
- Reading of denoising paper - [ridnet, iccv19] real image denoising with feature attention
- Shansi Valley P290 polymorphism exercise
猜你喜欢

線性代數第二章-矩陣及其運算

Pytorch learning record (XI): data enhancement, torchvision Explanation of various functions of transforms

Anaconda installed pyqt5 and pyqt5 tools without designer Exe problem solving

Pytorch notes - complete code for linear regression & manual or automatic calculation of gradient code comparison

List segmentation best practices

A sharp tool to improve work efficiency

Filebrowser realizes private network disk

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

Pytorch學習記錄(十三):循環神經網絡((Recurrent Neural Network)

自动控制(韩敏版)
随机推荐
Pyqy5 learning (III): qlineedit + qtextedit
Implementation of displaying database pictures to browser tables based on thymeleaf
Paper on Image Restoration - [red net, nips16] image restoration using very deep revolutionary encoder decoder networks wi
Pytoch learning record (x): data preprocessing + batch normalization (BN)
Gaussian processes of sklearn
图解numpy数组矩阵
Fact final variable and final variable
Shansi Valley P290 polymorphism exercise
LDCT图像重建论文——Eformer: Edge Enhancement based Transformer for Medical Image Denoising
Pytorch notes - get familiar with the network construction method by building RESNET (complete code)
Exception handling: grab and throw model
Pytorch Learning record (XIII): Recurrent Neural Network
Explain of MySQL optimization
治療TensorFlow後遺症——簡單例子記錄torch.utils.data.dataset.Dataset重寫時的圖片維度問題
SQL injection
Contrôle automatique (version Han min)
Why does the subscript of the array start from 0 instead of 1?
Class loading and classloader understanding
无监督去噪——[TMI2022]ISCL: Interdependent Self-Cooperative Learning for Unpaired Image Denoising
Algèbre linéaire chapitre 1 - déterminants