Java List±éÀú·½·¨ ¼°ÆäЧÂʶԱÈ
One:14109
Two:14000
Three:15141
four:14297
package com.zbalpha.test;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class ListTest {
public static void main(String args[]){
List<Long> lists = new ArrayList<Long>();
for(Long i=0l;i<1000000l;i++){
lists.add(i);
}
Long oneOk = oneMethod(lists);
Long twoOk = twoMethod(lists);
Long threeOk = threeMethod(lists);
Long fourOk = fourMethod(lists);
System.out.println("One:" + oneOk);
System.out.println("Two:" + twoOk);
System.out.println("Three:" + threeOk);
System.out.println("four:" + fourOk);
}
public static Long oneMethod(List<Long> lists){
Long timeStart = System.currentTimeMillis();
for(int i=0;i<lists.size();i++) {
System.out.println(lists.get(i));
}
Long timeStop = System.currentTimeMillis();
return timeStop -timeStart ;
}
&
Ïà¹ØÎĵµ£º
³£ÓõÄÉè¼Æģʽ·ÖΪÈçÏ 23 ÖÖģʽ£º
Abstract Factory£º
Ìṩһ¸ö´´½¨Ò»ÏµÁÐÏà¹Ø»òÏ໥ÒÀÀµ¶ÔÏóµÄ½Ó¿Ú£¬¶øÎÞÐèÖ¸¶¨Ëü
ÃǾßÌåµÄÀà¡£
Adapter£º
½«Ò»¸öÀàµÄ½Ó¿Úת»»³É¿Í»§Ï£ÍûµÄÁíÒ»¸ö½Ó¿Ú£¬Ê¹µÃÔÀ´ÓÉÓÚ½Ó¿Ú²»¼æÈݶø²»ÄÜÒ»Æð¹¤×÷µÄÄÇЩÀà¿ÉÒÔÒ»Æð¹¤×÷¡£
Bridge£º
½«
³éÏ󲿷ÖÓëËüµÄʵÏÖ²¿·Ö·ÖÀ룬ʹ֮¿ÉÒÔ¶ÀÁ¢±ä»¯¡ ......
ºÜ¾ÃûÉÏÀ´ÁË£¬·¢ÏÖËäÈ»×ÊÁϺÍÊé¿´µÄºÜ¶à£¬µ«ÊǺܾÃûÅöµÄ¶«Î÷»¹ÊǺÜÈÝÒ×µÍü¡£ÒÔºóÏ£ÍûÄܶà¼Ç¼°É¡£
½ñÌìÍæÁË°ÑÏ̳߳أ¬²¢¶ÔÆäÖеIJÎÊý×öÁËһЩµ÷Õû£¬²¢¼Ç¼Ôڶಢ·¢Çé¿öÏÂÏß³ÌÊý¶Ô¸÷ÖÖÇé¿öµÄ·´Ó¦¡£³ÌÐòÊÇÍøÉÏÕҵģ¬²¢×÷ÁËÉÔ΢Ð޸ġ£
javaµÄÏ̳߳ØʵÏÖ£¬ThreadPool
package net.zj.hz.yk.thr ......
JavaµÄÊý¾Ý½á¹¹ÓÐÄÄЩ£¿MapÓëSetµÄ±¾ÖÊÇø±ðÊÇʲô£¿
·ÖÎö£ºJava³£¼ûµÄÊý¾Ý½á¹¹ÓÐCollectionºÍMap£¬ÆäÖÐCollection½Ó¿ÚÏ°üÀ¨ListºÍSet½Ó¿Ú£¬ÆäÏÂÓÖÓжà¸öʵÏÖÀàÈçListÏÂÓÐArrayList¡¢LinkedListºÍVectorµÈʵÏÖÀ࣬SetÏÂÓÐHashSet¡¢LinkedSetµÈʵÏÖÀàºÍSortedSet½Ó¿Ú£¬HashSetÏÂÓÐLinkedHashSet×ÓÀ࣬SortedSet½Ó¿ÚÏÂÓÐTre ......
¼´½«Òª×ßÉϹ¤×÷¸ÚλÁË£¬µ«ÊÇ×Ô¼º»¹ÔÚÓÌÔ¥Öе½µ×ÊÇÑ¡Ôñc#»¹ÊÇjava£¬¶¼ËµjavaÒÔºóµÄÇ°¾°·Ç³£µÄÀÖ¹Û£¬Ö÷ÒªÊÇÌåÏÖÔÚÒƶ¯Í¨ÐÅƽ̨ÉÏ£¬µ«ÊÇC#×÷Ϊ΢ÈíµÄ“ɱÊÖïµ”£¬Óë´Ëͬʱ΢Èí×÷Ϊҵ½çÀÏ´óµÄµØλËÓÖÄܺ³¶¯ÄÄ£¬Î´À´µÄÔƼÆËã¶Ô¼ÆËã»úÖÕ¶Ëƽ̨µÄ¸ïÃüÐԵĸı䣬windows²Ù×÷ϵͳµÄ°ÔÖ÷µØλ²ÅÓпÉÄܱ»º³¶¯¡£c#µÄ·½±ã¼òµ¥Ó ......
public class Test{
public static void main(String args[]){
System.out.println("This is a test program.");
}
}
½«ÉÏÃæµÄÕâ¶Î³ÌÐò±£´æΪÎļþÃûΪTest.javaµÄÎļþ¡£
È»ºó´ò¿ªÃüÁîÌáʾ·û´°¿Ú£¬cdµ½ÄãµÄTest.javaËùÔÚĿ¼£¬È»ºó¼üÈëÏÂÃæµÄÃüÁî
javac Test.java
³ö´í:
Àà Test Êǹ«¹²µÄ£¬Ó¦ ......