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

java:javaÖÐMapÀàÓÐʲô×÷Ó㬾ßÌåÔõôÓÃÄØ

java:javaÖÐMapÀàÓÐʲô×÷Ó㬾ßÌåÔõôÓÃÄØ??
2007-11-11 11:59
Java Map ¼¯ºÏÀà¼ò½é
×÷ÕߣºJack Shirazi
Á˽â×î³£Óõļ¯ºÏÀàÐÍÖ®Ò» Map µÄ»ù´¡ÖªÊ¶ÒÔ¼°ÈçºÎÕë¶ÔÄúÓ¦ÓóÌÐòÌØÓеÄÊý¾ÝÓÅ»¯ Map¡£
±¾ÎÄÏà¹ØÏÂÔØ£º
· Jack µÄ HashMap ²âÊÔ
· Oracle JDeveloper 10g
java.util Öеļ¯ºÏÀà°üº¬ Java ÖÐijЩ×î³£ÓõÄÀà¡£ ×î³£Óõļ¯ºÏÀàÊÇ List ºÍ Map¡£ List µÄ¾ßÌåʵÏÖ°üÀ¨ ArrayList ºÍ Vector£¬ËüÃÇÊǿɱä´óСµÄÁÐ±í£¬±È½ÏÊʺϹ¹½¨¡¢´æ´¢ºÍ²Ù×÷ÈκÎÀàÐͶÔÏóµÄÔªËØÁÐ±í¡£ List ÊÊÓÃÓÚ°´ÊýÖµË÷Òý·ÃÎÊÔªËصÄÇéÐΡ£
Map ÌṩÁËÒ»¸ö¸üͨÓõÄÔªËØ´æ´¢·½·¨¡£ Map ¼¯ºÏÀàÓÃÓÚ´æ´¢ÔªËضԣ¨³Æ×÷“¼ü”ºÍ“Öµ”£©£¬ÆäÖÐÿ¸ö¼üÓ³Éäµ½Ò»¸öÖµ¡£ ´Ó¸ÅÄîÉ϶øÑÔ£¬Äú¿ÉÒÔ½« List ¿´×÷ÊǾßÓÐÊýÖµ¼üµÄ Map¡£ ¶øʵ¼ÊÉÏ£¬³ýÁË List ºÍ Map ¶¼ÔÚ¶¨Òå java.util ÖÐÍ⣬Á½Õß²¢Ã»ÓÐÖ±½ÓµÄÁªÏµ¡£±¾ÎĽ«×ÅÖؽéÉܺËÐÄ Java ·¢ÐÐÌ×¼þÖи½´øµÄ Map£¬Í¬Ê±»¹½«½éÉÜÈçºÎ²ÉÓûòʵÏÖ¸üÊÊÓÃÓÚÄúÓ¦ÓóÌÐòÌض¨Êý¾ÝµÄרÓà Map¡£
Á˽â Map ½Ó¿ÚºÍ·½·¨
Java ºËÐÄÀàÖÐÓкܶàÔ¤¶¨ÒåµÄ Map Àà¡£ ÔÚ½éÉܾßÌåʵÏÖ֮ǰ£¬ÎÒÃÇÏȽéÉÜһϠMap ½Ó¿Ú±¾Éí£¬ÒÔ±ãÁ˽âËùÓÐʵÏֵĹ²Í¬µã¡£ Map ½Ó¿Ú¶¨ÒåÁËËÄÖÖÀàÐ͵ķ½·¨£¬Ã¿¸ö Map ¶¼°üº¬ÕâЩ·½·¨¡£ ÏÂÃ棬ÎÒÃÇ´ÓÁ½¸öÆÕͨµÄ·½·¨£¨±í 1£©¿ªÊ¼¶ÔÕâЩ·½·¨¼ÓÒÔ½éÉÜ¡£
±í 1£º ¸²¸ÇµÄ·½·¨¡£ ÎÒÃǽ«Õâ Object µÄÕâÁ½¸ö·½·¨¸²¸Ç£¬ÒÔÕýÈ·±È½Ï Map ¶ÔÏóµÄµÈ¼ÛÐÔ¡£
equals(Object o)
±È½ÏÖ¸¶¨¶ÔÏóÓë´Ë Map µÄµÈ¼ÛÐÔ
hashCode()
·µ»Ø´Ë Map µÄ¹þÏ£Âë
Map ¹¹½¨
Map ¶¨ÒåÁ˼¸¸öÓÃÓÚ²åÈëºÍɾ³ýÔªËصı任·½·¨£¨±í 2£©¡£
±í 2£º Map ¸üз½·¨£º ¿ÉÒÔ¸ü¸Ä Map ÄÚÈÝ¡£
clear()
´Ó Map ÖÐɾ³ýËùÓÐÓ³Éä
remove(Object key)
´Ó Map ÖÐɾ³ý¼üºÍ¹ØÁªµÄÖµ
put(Object key, Object value)
½«Ö¸¶¨ÖµÓëÖ¸¶¨¼üÏà¹ØÁª
clear()
´Ó Map ÖÐɾ³ýËùÓÐÓ³Éä
putAll(Map t)
½«Ö¸¶¨ Map ÖеÄËùÓÐÓ³É临ÖƵ½´Ë map
¾¡¹ÜÄú¿ÉÄÜ×¢Òâµ½£¬×ÝÈ»¼ÙÉèºöÂÔ¹¹½¨Ò»¸öÐèÒª´«µÝ¸ø putAll() µÄ Map µÄ¿ªÏú£¬Ê¹Óà putAll() ͨ³£Ò²²¢²»±ÈʹÓôóÁ¿µÄ put() µ÷ÓøüÓÐЧÂÊ£¬µ« putAll() µÄ´æÔÚÒ»µãÒ²²»Ï¡Ææ¡£ ÕâÊÇÒòΪ£¬putAll() ³ýÁ˵ü´ú put() ËùÖ´ÐеĽ«Ã¿¸ö¼üÖµ¶ÔÌí¼Óµ½ Map µÄËã·¨ÒÔÍ⣬»¹ÐèÒªµü´úËù´«µÝµÄ Map µÄÔªËØ¡£ µ«Ó¦×¢Ò⣬putAll() ÔÚÌí¼ÓËùÓÐÔªËØ֮ǰ¿ÉÒÔÕýÈ·µ÷Õû Map µÄ´óС£¬Òò´ËÈç¹ûÄúδÇ××Ôµ÷Õû Map µÄ´óС£¨ÎÒÃǽ«¶Ô´Ë½øÐмòµ¥½éÉÜ£©


Ïà¹ØÎĵµ£º

java ÀûÓÃXSD ÑéÖ¤XMLÎļþ

XSDÎļþ £¨XML Schema ÓïÑÔÒ²³Æ×÷ XML Schema ¶¨Ò壨XML Schema Definition£¬XSD£©¡£ ¾ßÌåʹÓ÷½·¨ºÍ¶¨ÒåÇë²Î¿´£º
http://www.w3school.com.cn/schema/index.asp
java×Ôjdk1.5ÒÔÉÏÐÂÔöÁËSchemaFactoryÀà ¿ÉÒÔʵÏÖ¶ÔXSDÑéÖ¤µÄÖ§³Ö£¬Ê¹ÓÃÆðÀ´Ò²ºÜ·½±ã¡£
ÒÔÏ´úÂë¿ÉÓÃÔÚJDK1.5+ ÑéÖ¤xml
public class SimpleErrorHandler i ......

java µ½Êý¾Ý¿â


public ActionForward backUpAction(ActionMapping mapping, ActionForm form,   
            HttpServletRequest request, HttpServletResponse response)   
    &n ......

java ioÁ÷×ܽá

Java IOµÄÒ»°ãʹÓÃÔ­Ôò£º
Ò»¡¢°´Êý¾ÝÀ´Ô´£¨È¥Ïò£©·ÖÀࣺ
1¡¢ÊÇÎļþ£º FileInputStream, FileOutputStream, FileReader, FileWriter
2¡¢ÊÇbyte[]£ºByteArrayInputStream, ByteArrayOutputStream
3¡¢ÊÇChar[]: CharArrayReader, CharArrayWriter
4¡¢ÊÇString: StringBufferInputStream, StringReader, StringWriter
5¡¢ ......

È«Ãæ·ÖÎöJavaµÄÀ¬»ø»ØÊÕ»úÖÆ

JavaµÄ¶ÑÊÇÒ»¸öÔËÐÐʱÊý¾ÝÇø£¬ÀàµÄʵÀý(¶ÔÏó)´ÓÖзÖÅä¿Õ¼ä¡£JavaÐéÄâ»ú(JVM)
µÄ¶ÑÖд¢´æ×ÅÕýÔÚÔËÐеÄÓ¦ÓóÌÐòËù½¨Á¢µÄËùÓжÔÏó£¬ÕâЩ¶ÔÏóͨ¹ýnew¡¢newarray¡¢anewarrayºÍmultianewarrayµÈÖ¸Á
Á¢£¬µ«ÊÇËüÃDz»ÐèÒª³ÌÐò´úÂëÀ´ÏÔʽµØÊÍ·Å¡£Ò»°ãÀ´Ëµ£¬¶ÑµÄÊÇÓÉÀ¬»ø»ØÊÕ
À´¸ºÔðµÄ£¬¾¡¹ÜJVM¹æ·¶²¢²»ÒªÇóÌØÊâµÄÀ¬»ø»ØÊÕ¼¼Êõ£ ......

java¿¼ÊÔ֪ʶµã´óÈ«

1.ʹÓÃAjaxµÄºÃ´¦£º
    ¿ÉÒÔͨ¹ýJavaScript·¢ËÍÇëÇóµ½·þÎñÆ÷£¬²¢»òµÃ·µ»ØµÄ½á¹û£¬ÔÚ±ØÒªµÄʱºòÐèÒª¸üÐÂÒ³ÃæµÄÒ»²¿·Ö£¬¶ø²»ÒªÕû¸öÒ³Ã涼ˢУ¬Ò²³ÆΪ£º“ÎÞˢД¼¼Êõ  ÌṩÁ¬ÐøµÄÓû§ÌåÑ飬¶ø²»±»Ë¢ÐÂÖжÏ
2.ʲôÊÇAjax
  ËüÊÇAsynchronous(Òì²½µÄ)£¬JavaScript And XmlµÄ¼òд£»
3 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ