list = new ArrayList<>();
for(int i=0;i<10;i++){
list.add(i);
}
test.m1(list);
long et2 = System.currentTimeMillis();
System.out.println("[1]耗时:"+(et2 - bt)+ "ms");
Thread thread = new Thread();
long at = System.currentTimeMillis();
test.m2();
long et3 = System.currentTimeMillis();
System.out.println("[2]耗时:"+(et3 - at)+ "ms");
}
public void m1( Listlist) {
ExecutorService pool = Executors.newCachedThreadPool();
CountDownLatch latch = new CountDownLatch(list.size());
for (int i = 0; i < list.size(); i++) {
final int index = i;
Runnable run = new Runnable() {
public void run() {
try {
new Thread().slee