Java???????????????
???????????? ???????[ 2014/10/15 11:07:55 ] ????????Java ??????
???????????д????????????Java?????????Щ????????????????????磺??????????????????????????С?Synchronizer??????CountDownLatch?????????????????????????
?????.?????????????????
??????Java?????????????У????????????List??Set??Queue??Map??
????List??Set??Queue?????????Collection????Map?????????????
???????Collection??Map??????????????List??Set??Queue??????Collection?????????????顢??????????????????????
??????ArrayList??LinkedList?????????List????HashSet?????Set??????Deque???????У?????????????β?????????????????????Queue????PriorityQueue?????Queue????????LinkedList????????????????????????Deque????
??????ArrayList??LinkedList??HashMap??Щ?????????????????
????????ж???????????????Щ????????????????
???????????д??????????????????????????κη??????Щ???????????????????????????????????Щ??????????????????
?????????Java??????????????????á?
??????.Java?е??????????
??????Java?У???????????????2??
????1??Vector??Stack??HashTable
????2??Collections??????????????????????????
????Vector?????List????Vector?????????????飬??ArrayList?????????Vector?е????????synchronized??????????????????????
????Stack?????????????????????????synchronized????????????????????????Vector??
????HashTable?????Map????????HashMap???????????HashTable????????????????HashMap??С?
????Collections??????????????????????Collection?????Collection???????????????Collections??????????????????????????????????????????????????????????????????????????????????????????????????????????????
??????.????????????
????????????????????????????????????е??????????synchronized???????????????????????????????????????????????????????????????????????????????????????????
??????????????????′????????????????????????????????????ArrayList??Vector?????
????1.????????
????????????????????????Vector??ArrayList????????????????????
public class Test {
public static void main(String[] args) throws InterruptedException {
ArrayList<Integer> list = new ArrayList<Integer>();
Vector<Integer> vector = new Vector<Integer>();
long start = System.currentTimeMillis();
for(int i=0;i<100000;i++)
list.add(i);
long end = System.currentTimeMillis();
System.out.println("ArrayList????100000?β???????????"+(end-start)+"ms");
start = System.currentTimeMillis();
for(int i=0;i<100000;i++)
vector.add(i);
end = System.currentTimeMillis();
System.out.println("Vector????100000?β???????????"+(end-start)+"ms");
}
}
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11