Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java×Ô¶¯×°Ïä¡¢×Ô¶¯²ðÏäºÍÕý³£Çé¿öÐÔÄܱȽÏ

×Ô¶¯×°ÏäºÍ×Ô¶¯²ðÏäÊÇjava5.0°æ±¾ÒýÈëµÄ£¬ÄÜ×Ô¶¯½«»ù±¾ÀàÐÍת»»Îª¶ÔÓ¦µÄ»ù±¾ÀàÐÍ°ü×°¶ÔÏó£¬ÄÇôÎÒÃDZȽÏÒ»ÏÂËûÃǵÄÐÔÄÜÇé¿ö¡£
package com.wmmad.test;
import junit.framework.TestCase;
/**
* @author madding.lip
*
* <pre>
* class: compare the autoboxing and unboxing and normal's performance
* </pre>
*
*/
@SuppressWarnings("unused")
public class BoxTest extends TestCase {
public static void main(String[] args) {
testAutoboxing();
testUnboxing();
testChangeToObject();
testChangeToData();
testNormal();
testNormal1();
}
public static void testAutoboxing() {
long start = System.currentTimeMillis();
Integer result = 0;
for (int i = 0; i < 1000000000; i++) {
result = i; // autoboxing
}
long end = System.currentTimeMillis();
System.out.println("autoboxing use time is£º " + (end - start) + "ms");
}
public static void testUnboxing() {
int result = 0;
long start = System.currentTimeMillis();
for (Integer i = 0; i < 1000000000; i++) {
result = i;
}
long end = System.currentTimeMillis();
System.out.println("unboxing use time is£º " + (end - start) + "ms");
}

public static void testChangeToObject() {
Integer result = 0;
long start = System.currentTimeMillis();
for(int i = 0; i < 1000000000; i++) {
result = (Integer)i;
}
long end = System.currentTimeMillis();
System.out.println("change to object use time is: " + (end - start) + "ms");
}

public static void testChangeToData() {
int result = 0;
long start = System.currentTimeMillis();
for(Integer i = 0; i < 1000000000; i++) {
result = i.intValue();
}
long end = System.currentTimeMillis();
System.out.println("change to data use time is: " + (end - start) + "ms");
}
public static void testNormal() {
int result = 0;
long start = System.currentTimeMillis();
for (int i = 0; i


Ïà¹ØÎĵµ£º

ÀûÓÃLuceneËÑË÷JavaÔ´´úÂë

ijЩÍøÕ¾ÔÊÐíÈí¼þ¿ª·¢ÉçÍÅͨ¹ý·¢²¼¿ª·¢ÕßÖ¸ÄÏ¡¢°×ƤÊé¡¢FAQs¡¾³£¼ûÎÊÌâ½â´ð¡¿ºÍÔ´´úÂëÒÔʵÏÖÐÅÏ¢µÄ¹²Ïí¡£Ëæ×ÅÐÅÏ¢Á¿µÄÔö³¤£¬ºÍ¼¸¸ö¿ª·¢Õß¹±Ï׳ö×Ô¼ºµÄ֪ʶ¿â£¬ÓÚÊÇÍøÕ¾ÌṩËÑË÷ÒýÇæÀ´ËÑË÷Õ¾µãÉÏÏÖÓеÄËùÓÐÐÅÏ¢¡£ËäÈ»ÕâЩËÑË÷ÒýÇæ¶ÔÎı¾ÎļþµÄËÑË÷¿ÉÒÔ×öµÄºÜºÃ£¬µ«¶Ô¿ª·¢ÕßËÑË÷Ô´´úÂë×öÁ˱ȽÏÑϸñµÄÏÞÖÆ¡£ËÑË÷ÒýÇæÈÏΪԴ´úÂë ......

¡¶Effective Java¡·±Ê¼Ç

µÚÒ»ÕÂ ÒýÑÔ
(By wind5shy£ºhttp://blog.csdn.net/wind5shy)
 
µÚ¶þÕ ´´½¨ºÍÏú»Ù¶ÔÏó
(By wind5shy£ºhttp://blog.csdn.net/wind5shy)
µÚ1Ìõ£º¿¼ÂÇÓþ²Ì¬¹¤³§·½·¨´úÌæ¹¹Ô캯Êý
 
ºÃ´¦£º
¾²Ì¬¹¤³§·½·¨ÓÐÃû×Ö£¬±í´ï¸üÇå³þ¡£
²»Ðè´´½¨ÐµĶÔÏó¡£
¿ÉÒÔ·µ»ØÔ­·µ»ØÀàÐ͵Ä×ÓÀàÐͶÔÏó¡£Ó¦Óãº1.·µ»ØÀàÐͶ¨ÒåΪ½ ......

Java Concurrent°üѧϰ֮ConcurrentHashMap

ÔÚJava concurrent°üÖÐÓÐÕâôһ¸ö½Ó¿Ú£ºConcurrentMap¡£
ConcurrentMap¼Ì³Ð×ÔMap£¬²¢Ìí¼ÓÁ˼¸¸öеÄÔ­×Ó·½·¨£º putIfAbsent¡¢remove¡¢replace
Æä·½·¨ÕªÒªÈçÏ£º
 V
putIfAbsent(K key, V value)
          Èç¹ûÖ¸¶¨¼üÒѾ­²»ÔÙÓëij¸öÖµÏà¹ØÁª£¬Ôò½ ......

javaÖеÄsynchronized¹Ø¼ü×Ö

À´Ô´: http://xfshiyuan.blog.sohu.com/100496073.html  
ÓÉÓÚͬһ½ø³ÌµÄ¶à¸öÏ̹߳²ÏíͬһƬ´æ´¢¿Õ¼ä£¬ÔÚ´øÀ´·½±ãµÄͬʱ£¬Ò²´øÀ´ÁË·ÃÎʳåÍ»Õâ¸öÑÏÖصÄÎÊÌâ¡£JavaÓïÑÔÌṩÁËרÃÅ»úÖÆÒÔ½â¾öÕâÖÖ³åÍ»£¬ÓÐЧ±ÜÃâÁËͬһ¸öÊý¾Ý¶ÔÏ󱻶à¸öÏß³Ìͬʱ·ÃÎÊ¡£
¡¡¡¡ÐèÒªÃ÷È·µÄ¼¸¸öÎÊÌ⣺
¡¡¡¡1)synchronized¹Ø¼ü×Ö¿É ......

javaѧϰ±Ê¼Ç 1.³õ²½½éÉÜ

Ò».javaÈý¸ö·½Ïò
j2se ×ÀÃ濪·¢  £¨»ù´¡£©
j2ee web¿ª·¢
j2me ÊÖ»ú¿ª·¢
¶þ.¿ª·¢¹¤¾ß
¼Çʱ¾
jcreator
jbuilder
netbean
elipse£¨IBM£©
......
Èý.javaÓïÑÔÌصã
¼òµ¥
ÃæÏò¶ÔÏó
¿çƽ̨£¨Ò»´Î±àÒ룬µ½´¦ÔËÐУ©
¸ßÐÔÄÜ
ËÄ.°²×°ºÍÅäÖÃjdk
jdk£¿
java development kit java¿ª·¢¹¤¾ß°ü
°üÀ¨£ºjre£¨javaÔËÐ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ