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
Ïà¹ØÎĵµ£º
ÊÂÎñ´¦Àí×ܽá
À´Ô´£ºhttp://space.itpub.net/13956325/viewspace-598381
Ò»¡¢Ê²Ã´ÊÇJava ÊÂÎñ
ͨ³£µÄ¹ÛÄîÈÏΪ£¬ÊÂÎñ½öÓëÊý¾Ý¿â Ïà¹Ø¡£
Ê Îñ±ØÐë·þ´ÓISO/IECËùÖÆ¶¨µÄACIDÔÔò¡£ACIDÊÇÔ×ÓÐÔ£¨atomicity£©¡¢Ò»ÖÂÐÔ£¨consistency£©¡¢¸ôÀëÐÔ £¨isolation£©ºÍ³Ö¾ÃÐÔ£¨durability£©µÄËõд¡£ÊÂÎñµÄÔ×ÓÐÔ±íʾÊÂÎñ ......
1¡¢Óï·¨£º±ØÐë±È½ÏÊìϤ£¬ÔÚд´úÂëµÄʱºòIDEµÄ±à¼Æ÷¶ÔijһÐб¨´íÓ¦¸ÃÄܹ»¸ù¾Ý±¨´íÐÅÏ¢ÖªµÀÊÇʲôÑùµÄÓï·¨´íÎó²¢ÇÒÖªµÀÈκÎÐÞÕý¡£
2¡¢ÃüÁ±ØÐëÊìϤJDK´øµÄһЩ³£ÓÃÃüÁî¼°Æä³£ÓÃÑ¡ÏÃüÁîÖÁÉÙÐèÒªÊìϤ£ºappletviewer¡¢ HtmlConverter¡¢jar¡¢ java¡¢javac¡¢javadoc¡¢javap¡¢javaw¡¢native2ascii ......
Ò»Ö±ÒÔÀ´¶¼ÊÇ΢ÈíµÄËÀÖÒ£¬ÎÒÒ»Ö±¹ÌÖ´µÄʹÓÃ×Å΢ÈíµÄ²úÆ·¡£´Ó2001Äêµ½½ñÄê2010Ä꣬ÒѾ¶È¹ýÁË9ÄêµÄʱ¹â£¬¿´×ÅËüµÄ½ø²½£¬Ò²¿´µ½ÁËjava¶ÔËüµÄ²Ïʳ¡£´Ó×î³õ´ó¼Ò¶Ô΢ÈíÊÇ·ñÒ»Ö»¶À´ó£¬µ½ÏÖÔÚÎÒµ£ÐÄvsϵÁвúÆ·ÊÇ·ñ±»javaËùÍÌû¡£
Îҵĵ£ÐIJ»ÊÇûÓеÀÀí£¬ÉõÖÁÎÒΪÁ˼á³ÖÎÒµÄ΢Èí·Ïß¶ø·ÅÆúÁËÏÖÔڵŤ×÷¡£
ÔÚ×öСÐÍÏîÄ¿ºÍ×ÀÃæÐÍÏîÄ ......
package Sets;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
/**
* java¼¯ºÏ²Ù×÷
*
......