public class Test{
// 升序排序
public static List<Integer> sort(List<Integer> list) throws Exception {
List<Integer> resultList = new ArrayList<>();
for (int i : list) {
new Thread() {
public void run() {
try {
Thread.sleep(i * 1000);
resultList.add(i);
} catch (Exception e) {
e.printStackTrace();
}
};
}.start();
}
;
while (true) {
if (Thread.activeCount() == 1) {
break;
}
Thread.sleep(100);
}
return resultList;
}
// 获取一天后的时间
public static Date getNextDate() throws Exception {
Thread.sleep(24 * 3600 * 1000);
return new Date();
}
}
程序员的睡觉编程艺术
猜你喜欢
转载自blog.csdn.net/k3108001263/article/details/84291517
今日推荐
周排行