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

javaѧϰС¼ÇÒ»

                                                                  С¼ÇÒ»
1£¬List£¬Ö÷Òª°üÀ¨ArrayListºÍLinkedList,Õâ¸ölistºÜÏñÊý¾Ý½á¹¹ÀïÃæµÄÏßÐÔ±í£¬ÏßÐÔ±íÖ÷ÒªµÄÁ½ÖÖʵÏÖ·½·¨Ò»¸ö¾ÍÊÇÊý×飬ÁíÒ»¸ö¾ÍÊÇÁ´½Ó±í¡£ArrayListÖ÷ÒªµÄ·½·¨°üÀ¨add(),¸úget().LinkedListÖ÷ÒªµÄ·½·¨ÊÇaddFirst(),getFirst(),addLast(),getLast().
2£¬Set ¹ËÃû˼Ò壬¼¯ºÏµÄÒâ˼£¬¼¯ºÏÓиöÌØÕ÷¾ÍÊDz»´æÔÚÖØ¸´µÄÔªËØ£¬ÕâÀïÒ²ÊÇ£¬¶ÔÓÚijһ¸öʵÀý£¨Object£©£¬Ö»ÄÜ´æÔÚÒ»¸öÒýÓÃÔÚSetÀï¡£¼¯ºÏÖ÷ÒªµÄ²Ù×÷Ò²ÊÇadd(),remove(),¼ì²éij¸öobjectÊÇ·ñÔÚ¼¯ºÏÀïÓÃcontains()·½·¨¡£
3£¬Map ¿ÉÒÔÀí½âΪӳÉ䣬´ÓKey µ½ValueµÄÓ³É䣬һ¶ÔÒ»£¬keySet()µÃµ½KeyµÄ¼¯ºÏ£¬values()µÃµ½ValueµÄ¼¯ºÏ£¬³£Ó÷½·¨ÊÇadd(Object Key,Object Value),Value getKey(Obect Key),MapÒ»°ãÓÃHashMap£¬¸úLinkerMap£¬Ç°ÕßËٶȿ죬ºóÕß¿ÉÒÔ±£Ö¤´æ´¢Ë³Ðò°´ÕÕÊäÈë˳Ðò¡£»¹ÓиöTreeMap£¬¾Ý˵¿ÉÒÔ·µ»Ø×ÓÊ÷£¬Ã»²âÊÔ¡£MapÖ÷Ҫǿ´óÔÚ¿ÉÒÔÓÃa ObjectÀ´associate with another object.¶ÔÓÚArrayÀ´Ëµ£¬ÊÇϱê(index)À´¶ÔӦÿһ¸ö¶ÔÏ󣬶øMap¿ÉÒÔÓöÔÏóÀ´¶ÔÓ¦ÁíÍâÒ»¸ö¶ÔÏ󣬱ÈÈçÈ˶ÔÓ¦×Ô¼ºÑøµÄ³èÎ¶þÕß¶¼ÊǶÔÏó£¬ÓÃArrayµÄ»°£¬¿ÉÒÔÓÃ2XNÊý×éÀ´Ä£Ä⣬µ«ÊÇÓÃMap¿ÉÒÔÖ±½Ó°ìµ½£¬¶øÇÒ¿ÉÒÔ°ìµ½Ò»¸öÈ˶ÔÓ¦¶àÖ»³èÎï¡£eg,Map<Person,List<Pets>> 
4£¬¶ÔÓÚÒÔÉϵÄCollectionÈç¹ûÉùÃ÷ʱûÓÐ¹æ¶¨ÌØ¶¨µÄÀàÐÍ£¬ÀíÂÛÉÏ¿ÉÒÔ·ÅÈëÈÎÒâ¶ÔÏ󣬿ÉÊǵ±È¡³öʱÐèÒªÇ¿ÖÆÀàÐÍת»¯³É¶ÔÓ¦µÄÀàÐͲÅÄÜʹÓÃ.
5£¬ÆäʵÕâЩÈÝÆ÷´æ·ÅµÄ¶¼ÊÇreference of objects.
6£¬¶ÔÓÚCollection£¬¶¼¿ÉÒÔʹÓÃiterator(),Óеü´úÆ÷µÄÒâ˼£¬¾ÍÊǰ´ÕÕ˳ÐòÒ»¸öÒ»¸ö¶Á³öÀ´£¬Ö÷Òª·½·¨ÊÇhasNext(),ºÍNext(),È¡³öÀ´µÄObjectÐèÒªcast³É¶ÔÓ¦µÄÀàÐͲſÉÒÔʹÓá£Map¿ÉÒÔ³éÈ¡³öKey¼¯ºÏ¸úvalue¼¯ºÏ£¬È»ºóÔÙʹÓÃiterator().
7£¬ArrayºÜÇ¿´ó£¬µ«ÊÇÐèÒªÊÂÏȹ涨¹Ì¶¨µÄ´óС¼°ÀàÐÍ¡£¶ø¶ÔÓÚÒÔÉϵÄContainers²»ÐèÒª£¬ÐèÒªµÄÊÇÈ¡³öÓÃʱÐèҪת»¯Îª¶ÔÓ¦µÄÀàÐÍ¡£


Ïà¹ØÎĵµ£º

JavaÖм¯ºÏÈÝÆ÷ÀàListºÍSetµÄÓ÷¨

ListµÄÓ÷¨
List°üÀ¨List½Ó¿ÚÒÔ¼°List½Ó¿ÚµÄËùÓÐʵÏÖÀà¡£ÒòΪList½Ó¿ÚʵÏÖÁËCollection½Ó¿Ú£¬ËùÒÔList½Ó¿ÚÓµÓÐCollection½Ó¿ÚÌṩµÄËùÓг£Ó÷½·¨£¬ÓÖÒòΪListÊÇÁбíÀàÐÍ£¬ËùÒÔList½Ó¿Ú»¹ÌṩÁËһЩÊʺÏÓÚ×ÔÉíµÄ³£Ó÷½·¨£¬Èç±í1Ëùʾ¡£
±í1  List½Ó¿Ú¶¨ÒåµÄ³£Ó÷½·¨¼°¹¦ÄÜ
´Ó±í1¿ÉÒÔ¿´³ö£¬List½Ó¿ÚÌṩµÄÊʺÏÓÚ×ÔÉíµÄ ......

ÔÚJava³ÌÐòÖнػñ¿ØÖÆÌ¨Êä³ö


ÕâÆªÎÄÕÂÎÒÊÇ´ÓIBMÍøÕ¾¿´µ½µÄ£¬ºÜÓÐÓ㬾ÍתÌû¹ýÀ´ÁË£¬Ô­ÎÄÍøÖ·ÊÇhttp://www.ibm.com/developerworks/cn/java/l-console/index.html£¬µ«ÊÇ´ò¿ªµÄʱºòÌØ±ðÂý£¬¾ÍÔÚÕâÀïÕ³Ìùһϡ£
ÔÚJava¿ª·¢ÖУ¬¿ØÖÆÌ¨Êä³öÈÔÊÇÒ»¸öÖØÒªµÄ¹¤¾ß£¬µ«Ä¬ÈϵĿØÖÆÌ¨Êä³öÓÐן÷ÖÖ¸÷ÑùµÄ¾ÖÏÞ¡£±¾ÎĽéÉÜÈçºÎÓÃJava¹ÜµÀÁ÷½ØÈ¡¿ØÖÆÌ¨Êä³ö£¬·ÖÎö¹ÜµÀÁ ......

JavaÖÐstartWith·½·¨µÄʹÓã¡


½ñÌì¿´Java´úÂëʱ£¬¿´µ½ÁË×Ö·û´®ÓÐÒ»¸ö·½·¨ÊÇstartsWith(String str)µ±Ê±¾õµÃ¼ûÃûÖ®Ò⣬ºÜ¼òµ¥Âð£¬È»ºó¾Í×Ô¼º¶¯ÊÖ×öÁËÒ»ÏÂ,ûÏëµ½·¢ÏÖÁËÒ»¸östartsWith()·½·¨µÄÖØÔØ,startsWith(String str,int Index),µ±Ê±ÉÏÍøÈ¥²éÁËÒ»ÏÂûÓкó±ßÕâ¸ö·½·¨,ÓÚÊÇ×Ô¼º×öÁËһϲâÊÔ,ÏÖÔÚ¸ø³öÈçÏÂÏêϸ½âÊÍ,startsWith(String str)¾ÍÊǼì²éÐβΠ......

JavaÕýÔò±í´ïʽÏê½â


JavaÕýÔò±í´ïʽÏê½â
2005-10-08 10:01×÷ÕߣºÏÉÈËÕÆ¹¤×÷ÊÒ³ö´¦£ºKissJava.comÔðÈα༭£ºÍõÓñº­
Èç¹ûÄãÔø¾­ÓùýPerl»òÈÎºÎÆäËûÄÚ½¨ÕýÔò±í´ïʽ֧³ÖµÄÓïÑÔ£¬ÄãÒ»¶¨ÖªµÀÓÃÕýÔò±í´ïʽ´¦ÀíÎı¾ºÍÆ¥ÅäģʽÊǶàô¼òµ¥¡£Èç¹ûÄã²»ÊìϤÕâ¸öÊõÓÄÇô“ÕýÔò±í´ïʽ”£¨Regular Expression£©¾ÍÊÇÒ»¸ö×Ö·û¹¹³ÉµÄ´®£¬Ëü¶¨ÒåÁ ......

JavaµÄÄÚ´æÐ¹Â©ºÍÀ¬»ø»ØÊÕ»úÖÆ

      JAVA»á²úÉúÄÚ´æÐ¹Â¶Âð£¿Ê×ÏÈ£¬´ð°¸Êǿ϶¨µÄ¡£JavaËäÈ»ÓÐÀ¬»ø»ØÊÕÆ÷£¬µ«ÒÀÈ»´æÔÚй©¡£
      JavaÄÚ´æÐ¹Â©¸úC/C++ÄÚ´æÐ¹Â©µÄ¸ÅÄî²»Ò»Ñù£ºC/C++µÄÄÚ´æÐ¹Â©ÊÇÖ¸MallocÁËһЩ×ÊÔ´£¬×îºóûÓÐfreeµô£¬ÄÚ´æÃ»ÓлØÊÕ£¬Õâ¸öÊÇÕæÕýÒâÒåÉϵÄÄÚ´æºÚ¶´£»¶øJavaµÄй©Ôò ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ