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 ;
}
&
Ïà¹ØÎĵµ£º
public static void replaceString(String source,String oldStr,String newStr){
System.out.println(source);
String result = source.replaceAll("(?i)"+oldStr
, newStr); //´óСд²»Ãô ......
StringTokenizer Õâ¸öÀàÆäÊµÕæÕýÏîÄ¿ÀïÃæ¿ÖźÜÉÙ»áÓðɣ¿µ«ÊÇÕâ¸öÀàÕæµÄºÜʵÓã¬ÒòΪËü¿ÉÒÔ¸ù¾Ý×Ô¼ºµÄ·½Ê½°´ÕÕÒ»¶¨µÄ¹æÔòÀ´²ð·ÖÒ»¸ö×Ö·û´®
String s = new String("The Java platform is the ideal platform for network computing");
//ĬÈϵĹ¹Ô캯Êý£¬»á ......
javaÖÐ×Ö·û´®ºÍÕûÐÍÖ®¼äµÄת»¯
1£©ÈçºÎ½«×Ö·û´®×ª»¯ÎªÕûÐÍ£»
int i = Integer.parseInt(String str);
int i = Integer.valueOf().intValue();
×¢£ºInteger.parseIn ºÍ Integer.valueOf ²»Í¬£¬Ç°ÕßÉú³ÉµÄÊÇÕûÐÍ£¬¶øºóÕßÊÇÒ»¸ö¶ÔÏó£¬ËùÒÔҪͨ¹ýintValue()À´»ñµÃ¶ÔÏóµÄÖµ£»
&nb ......
¼´½«Òª×ßÉϹ¤×÷¸ÚλÁË£¬µ«ÊÇ×Ô¼º»¹ÔÚÓÌÔ¥Öе½µ×ÊÇÑ¡Ôñc#»¹ÊÇjava£¬¶¼ËµjavaÒÔºóµÄǰ¾°·Ç³£µÄÀÖ¹Û£¬Ö÷ÒªÊÇÌåÏÖÔÚÒÆ¶¯Í¨ÐÅÆ½Ì¨ÉÏ£¬µ«ÊÇC#×÷Ϊ΢ÈíµÄ“ɱÊÖïµ”£¬Óë´Ëͬʱ΢Èí×÷Ϊҵ½çÀÏ´óµÄµØÎ»ËÓÖÄܺ³¶¯ÄÄ£¬Î´À´µÄÔÆ¼ÆËã¶Ô¼ÆËã»úÖÕ¶ËÆ½Ì¨µÄ¸ïÃüÐԵĸı䣬windows²Ù×÷ϵͳµÄ°ÔÖ÷µØÎ»²ÅÓпÉÄܱ»º³¶¯¡£c#µÄ·½±ã¼òµ¥Ó ......