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

JavaÖжÔHashMapµÄÉî¶È·ÖÎö

ÔÚJavaµÄÊÀ½çÀÎÞÂÛÀ໹ÊǸ÷ÖÖÊý¾Ý£¬Æä½á¹¹µÄ´¦ÀíÊÇÕû¸ö³ÌÐòµÄÂß¼­ÒÔ¼°ÐÔÄܵĹؼü¡£ÓÉÓÚ±¾È˽Ӵ¥ÁËÒ»¸öÓйØÐÔÄÜÓëÂß¼­Í¬Ê±²¢´æµÄÎÊÌ⣬ÓÚÊǾͿªÊ¼Ñо¿Õâ·½ÃæµÄÎÊÌâ¡£ÕÒ±éÁË´ó´óССµÄÂÛ̳£¬Ò²°Ñ¡¶Java ÐéÄâ»ú¹æ·¶¡·£¬¡¶apress,.java.collections.(2001),.bm.ocr.6.0.shareconnector¡·£¬ºÍ¡¶Thinking in Java¡··­ÁËÒ²ÕÒ²»µ½ºÜºÃµÄ´ð°¸£¬ÓÚÊÇÒ»Æø֮ϰÑJDKµÄ src ½âѹ³öÀ´Ñо¿£¬À©È»¿ªÀÊ£¬Ëìд´ËÎÄ£¬¸ú´ó¼Ò·ÖÏí¸ÐÊܺÍ˳±ãÑéÖ¤ÎÒÀí½â»¹ÓÐûÓЩ¶´¡£ ÕâÀï¾ÍÄÃHashMapÀ´Ñо¿°É¡£
¡¡¡¡HashMap¿ÉνJDKµÄÒ»´óʵÓù¤¾ß£¬°Ñ¸÷¸öObjectÓ³ÉäÆðÀ´£¬ÊµÏÖÁË“¼ü£­£­Öµ”¶ÔÓ¦µÄ¿ìËÙ´æÈ¡¡£µ«Êµ¼ÊÀïÃæ×öÁËЩʲôÄØ£¿
¡¡¡¡ÔÚÕâ֮ǰ£¬ÏȽéÉÜһϸºÔØÒò×ÓºÍÈÝÁ¿µÄÊôÐÔ¡£´ó¼Ò¶¼ÖªµÀÆäʵһ¸ö HashMap µÄʵ¼ÊÈÝÁ¿¾Í Òò×Ó*ÈÝÁ¿£¬ÆäĬÈÏÖµÊÇ 16×0.75£½12£» Õâ¸öºÜÖØÒª£¬¶ÔЧÂʺÜÒ»¶¨Ó°Ï죡µ±´æÈëHashMapµÄ¶ÔÏ󳬹ýÕâ¸öÈÝÁ¿Ê±£¬HashMap ¾Í»áÖØй¹Ôì´æÈ¡±í¡£Õâ¾ÍÊÇÒ»¸ö´óÎÊÌ⣬ÎÒºóÃæÂýÂý½éÉÜ£¬·´Õý£¬Èç¹ûÄãÒѾ­ÖªµÀÄã´ó¸ÅÒª´æ·Å¶àÉÙ¸ö¶ÔÏó£¬×îºÃÉèΪ¸Ãʵ¼ÊÈÝÁ¿µÄÄܽÓÊܵÄÊý×Ö¡£
¡¡¡¡Á½¸ö¹Ø¼üµÄ·½·¨£¬putºÍget£º
¡¡¡¡ÏÈÓÐÕâÑùÒ»¸ö¸ÅÄHashMapÊÇÉùÃ÷ÁË Map£¬Cloneable, Serializable ½Ó¿Ú£¬ºÍ¼Ì³ÐÁË AbstractMap À࣬ÀïÃæµÄ Iterator ÆäʵÖ÷Òª¶¼ÊÇÆäÄÚ²¿ÀàHashIterator ºÍÆäËû¼¸¸ö iterator ÀàʵÏÖ£¬µ±È»»¹ÓÐÒ»¸öºÜÖØÒªµÄ¼Ì³ÐÁËMap.Entry µÄ Entry ÄÚ²¿À࣬ÓÉÓÚ´ó¼Ò¶¼ÓÐÔ´´úÂ룬´ó¼ÒÓÐÐËȤ¿ÉÒÔ¿´¿´Õⲿ·Ö£¬ÎÒÖ÷ÒªÏë˵Ã÷µÄÊÇ Entry ÄÚ²¿Àà¡£Ëü°üº¬ÁËhash£¬value£¬key ºÍnext ÕâËĸöÊôÐÔ£¬ºÜÖØÒª¡£putµÄÔ´ÂëÈçÏÂ
¡¡¡¡public Object put(Object key, Object value) {
¡¡¡¡Object k = maskNull(key);
¡¡¡¡Õâ¸ö¾ÍÊÇÅжϼüÖµÊÇ·ñΪ¿Õ£¬²¢²»ºÜÉî°Â£¬ÆäʵÈç¹ûΪ¿Õ£¬Ëü»á·µ»ØÒ»¸östatic Object ×÷Ϊ¼üÖµ£¬Õâ¾ÍÊÇΪʲôHashMapÔÊÐí¿Õ¼üÖµµÄÔ­Òò¡£
¡¡¡¡int hash = hash(k);
¡¡¡¡int i = indexFor(hash, table.length);
¡¡¡¡ÕâÁ¬ÐøµÄÁ½²½¾ÍÊÇ HashMap ×îÅ£µÄµØ·½£¡Ñо¿ÍêÎÒ¶¼º¹ÑÕÁË£¬ÆäÖÐ hash ¾ÍÊÇͨ¹ý key Õâ¸öObjectµÄ hashcode ½øÐÐ hash£¬È»ºóͨ¹ý indexFor »ñµÃÔÚObject tableµÄË÷ÒýÖµ¡£
¡¡¡¡table£¿£¿£¿²»Òª¾ªÑÈ£¬ÆäʵHashMapÒ²Éñ²»µ½ÄÄÀïÈ¥£¬Ëü¾ÍÊÇÓà table À´·ÅµÄ¡£×îÅ£µÄ¾ÍÊÇÓà hash ÄÜÕýÈ·µÄ·µ»ØË÷Òý¡£ÆäÖеÄhashËã·¨£¬ÎÒ¸úJDKµÄ×÷Õß Doug ÁªÏµ¹ý£¬Ëû½¨ÒéÎÒ¿´¿´¡¶The art of programing vol3¡·¿ÉºÞµÄÊÇ£¬ÎÒ֮ǰ¾ÍÒ»Ö±ÔÚÕÒ£¬ÎÒ¶¼ÕÒ²»µ½£¬Ë


Ïà¹ØÎĵµ£º

oracle ·µ»ØÒ»¸öjava¶ÔÏ󣬺ͷµ»Ø¶à¸öjava¶ÔÏóµÄ·½·¨

·µ»Ø¶à¸ö¶ÔÏó£º
    PROCEDURE AUTO_SEL_INVOICE_DETAIL(
  P_RESULT_LIST OUT SYS_REFCURSOR) AS
    BEGIN
    OPEN P_RESULT_LIST FOR
   SELECT DISTINCT CC.CHARGE_COLLECTION_ID CHARGE_COLLECTION_ID, CC.COLLECT_DATE COLLECT_DATE, C ......

JAVA System.getProperty()²ÎÊý


Java´úÂë < type="application/x-shockwave-flash" width="14" height="15" src="http://xiaoxinshome.javaeye.com/javascripts/syntaxhighlighter/clipboard_new.swf" pluginspage="http://www.macromedia.com/go/getflashplayer" allowscriptaccess="always" quality="high" flashvars="clipboard=%20%20%20%20%20 ......

JavaÄÚ´æ¹ÜÀí»úÖÆÓëGC

 
JavaÊÇÈçºÎ¹ÜÀíÄÚ´æ
ΪÁËÅжÏJavaÖÐÊÇ·ñÓÐÄÚ´æй¶£¬ÎÒÃÇÊ×ÏȱØÐëÁ˽âJavaÊÇÈçºÎ¹ÜÀíÄÚ´æµÄ¡£JavaµÄÄÚ´æ¹ÜÀí¾ÍÊǶÔÏóµÄ·ÖÅäºÍÊÍ·ÅÎÊÌâ¡£ÔÚJavaÖУ¬³ÌÐòÔ±ÐèҪͨ¹ý¹Ø¼ü×ÖnewΪÿ¸ö¶ÔÏóÉêÇëÄÚ´æ¿Õ¼ä (»ù±¾ÀàÐͳýÍâ)£¬ËùÓеĶÔÏó¶¼ÔÚ¶Ñ (Heap)ÖзÖÅä¿Õ¼ä¡£ÁíÍ⣬¶ÔÏóµÄÊÍ·ÅÊÇÓÉGC¾ö¶¨ºÍÖ´Ðеġ£ÔÚJavaÖУ¬ÄÚ´æµÄ·ÖÅäÊ ......

JavaÊý¾Ý±¨±à³ÌÖ®×é²¥


ÔÚÐÅϢʱ´ú£¬ÍøÂç¼¼ÊõÓ¦ÓÃÒѷdz£ÆÕͨ¡£ÆäÖзdz£¶àÓ¦Óö¼ÒÀÀµÓÚ´ÓÒ»¸öÖ÷»úÏò¶à¸öÖ÷»ú»ò´Ó¶à¸öÖ÷»úÏò¶à¸öÖ÷»ú·¢ËÍͬһÐÅÏ¢µÄÄÜÁ¦£¬ÔÚInternetÉÏ·Ö·¢µÄÊýÄ¿¿ÉÄÜ´ïÊýÊ®Íǫ̀£¬ÕâЩ¶¼ÐèÒª¸ü¸ßµÄ´ø¿í£¬²¢ÇÒ´ó´ó³¬³öÁ˵¥²¥µÄÄÜÁ¦¡£Ò»ÖÖÄÜ×î´óÏ޶ȵØÀûÓÃÏÖÓдø¿íµÄÖØÒª¼¼ÊõÊÇIP×é²¥¡£
1£®IP×é²¥¼¼ÊõµÄ¸ÅÄî
IP×é²¥¼¼Êõ£¬ÊÇÒ»ÖÖÔÊ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ