java¼¯ºÏ¿ò¼Ü
JavaΪÊý¾Ý½á¹¹µÄÓ³É䶨ÒåÁËÒ»¸ö½Ó¿Újava.util.Map.ËüÓÐËĸöʵÏÖÀ࣬·Ö±ðÊÇHashMap, Hashtable,LinkedHashMapºÍTreeMapÖ÷ÒªÓÃÓÚ´æ´¢¼üÖµ¶Ô£¬¸ù¾Ý¼üµÃµ½Öµ£¬Òò´Ë²»ÔÊÐí¼üÖظ´£¬µ«ÔÊÐíÖµÖظ´¡£
HashMapÊÇÒ»¸ö×î³£ÓõÄMap£¬Ëü¸ù¾Ý¼üµÄHashCodeÖµ´æ´¢Êý¾Ý£¬¸ù¾Ý¼ü¿ÉÒÔÖ±½Ó»ñÈ¡ËüµÄÖµ£¬¾ßÓкܿìµÄ·ÃÎÊËٶȣ¬±éÀúʱ£¬È¡µÃÊý¾ÝµÄ˳ÐòÍêÈ«ÊÇËæ»úµÄ¡£HashMap×î¶àÖ»ÔÊÐíÒ»Ìõ¼Ç¼µÄ¼üΪNull,ÔÊÐí¶àÌõ¼Ç¼µÄֵΪNull,µ±get()·½·¨·µ»Ønullֵʱ£¬¼È¿ÉÒÔ±íʾHashMapÖÐûÓиüü£¬Ò²¿ÉÒÔ±íʾ¸Ã¼üËù¶ÔÓ¦µÄֵΪnull,Òò´Ë£¬ÔÚHashMapÖв»ÄÜÓÉget()·½·¨À´ÅжÏHashMapÖÐÊÇ·ñ´æÔÚij¸ö¼ü£¬¶øÓ¦¸ÃÓÃcontainsKey()·½·¨À´Åжϡ£HashMap²»Ö§³ÖÏ̵߳Äͬ²½£¬¼´ÈÎһʱ¿Ì¿ÉÒÔÓжà¸öÏß³ÌͬʱдHashMap;¿ÉÄܻᵼÖÂÊý¾ÝµÄ²»Ò»Ö¡£Èç¹ûÐèҪͬ²½£¬¿ÉÒÔÓÃCollectionsµÄsynchronizdeMap·½·¨Ê¹HashMap¾ßÓÐͬ²½ÄÜÁ¦£¬»òÕßʹÓÃConcurrentHashMap.ÁíÍâHashMapÊÇ»ùÓÚ¹þÏ£±íʵÏֵģ¬HashMapµÄ¼üµÃÖØдhashCode()ºÍequals()·½·¨¡£
TreeMap
ÊÇʵÏÖSortedMap½Ó¿Ú£¬Äܹ»°ÑËü±£´æµÄ¼Ç¼¸ù¾Ý¼üÅÅÐò£¬Ä¬ÈÏÊÇ°´¼üÖµµÄÉýÐòÅÅÐò£¬Ò²¿ÉÒÔÖ¸¶¨ÅÅÐòµÄ±È½ÏÆ÷£¬µ±ÓÃIterator±éÀúTreeMapʱ£¬µÃµ½µÄ¼Ç¼ÊÇÅŹýÐòµÄ¡£ËùÒÔTreeMapµÄ¼üµÃʵÏÖComparabl,ûÓÐʵÏֵĻ°¾ÍÒª¸øTreeMapÖ¸¶¨Ò»¸öComparator
HashtableÖеķ½·¨ÊÇͬ²½µÄ£¬Ò²¼´ÊÇ˵£¬ÔÚ¶àÏß³ÌÓ¦ÓóÌÐòÖУ¬²»ÓÃרÃŵIJÙ×÷¾Í°²È«µØ¿ÉÒÔʹÓÃHashtableÁË£»¶øHashtable²»ÔÊÐí¼üֵΪ¿Õ¡£
ÄÚ²¿¹þÏ££º¹þÏ£Ó³Éä¼¼Êõ
¼¸ºõËùÓÐͨÓÃMap¶¼Ê¹ÓùþÏ£Ó³É䣬ÕâÊÇÒ»ÖÖ½«ÔªËØÓ³Éäµ½Êý×éµÄ·Ç³£¼òµ¥µÄ»úÖÆ£¬ÄúÓ¦Á˽â¹þÏ£Ó³ÉäµÄ¹¤×÷ÔÀí£¬ÒÔ±ã³ä·ÖÀûÓÃMap.
¹þÏ£Ó³Éä½á¹¹ÓÉÒ»¸ö´æ´¢ÔªËصÄÄÚ²¿Êý×é×é³É£¬ÓÉÓÚÄÚ²¿²ÉÓÃÊý×é´æ´¢£¬Òò´Ë±ØÈ»´æÔÚÒ»¸öÓÃÓÚÈ·¶¨ÈÎÒâ¼ü·ÃÎÊÊý×éµÄË÷Òý»úÖÆ£¬Êµ¼ÊÉϸûúÖÆÐèÒªÌṩһ¸öСÓÚÊý×é´óСµÄÕûÊýË÷ÒýÖµ£¬¸Ã»úÖƳÆ×÷¹þÏ£º¯Êý¡£ÔÚJava»ùÓÚ¹þÏ£µÄMapÖУ¬¹þÏ£º¯Êý½«¶ÔÏóת»»ÎªÒ»¸öÊʺÏÄÚ²¿Êý×éµÄÕûÊý£¬Äú±ð²»±ØΪѰÕÒÒ»¸öÒ×ÓÚʹÓõĹþÏ£º¯Êý¶ø´óÉËÄԽÿ¸ö¶ÔÏ󶼰üº¬Ò»¸ö·µ»ØÕûÊýÖµµÄhashCode()·½·¨£¬Òª½«¸ÃÖµÓ³Éäµ½Êý×飬ֻÐ轫Æäת»»ÎªÒ»¸öÕýÖµ£¬È»ºó½«¸ÃÖµ³ýÒÔÊý×é´óСºóÈ¡ÓàÊý¼´¿É£¬ÒÔÏÂÊÇÒ»¸ö¼òµ¥µÄ£¬ÊÊÓÃÓÚÈκζÔÏóµÄJava¹þÏ£º¯Êý
int hashvalue = Maths.abs(key.hashCode()) % table.length;
(%¶þ½øÖÆÔËËã·û(³Æ×÷Ä£)½«×ó²àµÄÖµ´¦ÒÔÓÒ²àµÄÖµ£¬È»ºó·µ»ØÕûÊýÐÎʽµÄÓàÊý¡£)
ʵ¼ÊÉÏ£¬ÔÚ1.4°æ·¢²¼Ö®Ç°£¬Õâ¾ÍÊǸ÷ÖÖ»ùÓÚ¹þÏ£
Ïà¹ØÎĵµ£º
±àÕß°´£ºÔçÔÚÉÏÊÀ¼Í90Äê´ú£¬¸÷ÖÖ¹ØÓÚJavaÒÑËÀµÄ¶ÏÑÔ¾ÍÒѾ¿ªÊ¼³öÏÖ¡£Ê®¶àÄêÖ®ºóµÄ½ñÄ꣬ÕâÑùµÄÑÔÂÛÒÀÈ»²»¾øÓÚ¶ú¡£ÒԹؼü´Ê"java is dead"ÔÚGoogleÖÐËÑË÷£¬µÃµ½´óÔ¼199,000Ìõ½á¹û£¬Óɴ˿ɼû²»ÉÙÈËд¹ý»òÆÀÂÛ¹ýJavaµÄËÀÍö¡£Õë¶ÔÕâÃÅÒÑËÀÊ®¶àÄêµÄÓïÑÔ£¬×÷ÕßÔÚÎÄÖиÅÊöÁ˵±½ñJavaµÄµØλ¼°Æä·¢Õ¹Ç÷ÊÆ£¬ÓÐÁ¦µØ»Ø»÷ÁËÕâЩ´«ÑÔ¡£È«Î ......
1. ×ÜÌåÉè¼Æ
1.1 »ù±¾Éè¼Æ¸ÅÄîºÍ´¦ÀíÁ÷³Ì
1.1.1 ³ÌÐò»®·Ö
Ö÷Òª·ÖΪ·þÎñ¶ËºÍ¿Í»§¶ËÁ½¸ö²¿·Ö¡£
¿Í»§¶Ë²¿·ÖÓÖ·ÖΪͬ²½ÓëÒì²½Á½ÖÖģʽ¡£
1.1.2 ´¦ÀíÁ÷³ÌÃèÊö
JAVA°æ½Ó¿Úƽ̨Ö÷ҪʵÏÖÓëÍⲿ½Ó¿ÚµÄ·þÎñ¶ËºÍ¿Í»§¶ËµÄꬄ ......
Õâ¸öÊǼÓͼƬˮӡµÄ!
package com.pic;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.awt.image.*;
import org.w3c.dom.*;
import com.sun.image.codec.jpeg.*;
import javax.imageio.*;
public class ImgBean_i{
public void ImgBean_i(){
}
public void ImgYin(S ......
HibernateÔÚSpringÅädataSource
S2SHÕûºÏ 2008-09-12 15:25 ÔĶÁ160 ÆÀÂÛ0
×ֺţº ´ó´ó ÖÐÖРСС
<!-- mysqlÊý¾ÝÔ´µÄÅäÖà -->
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource ......