JavaÖм¯ºÏ
JavaÌṩÁËÊýÖÖ³ÖÓжÔÏóµÄ·½Ê½£¬°üÀ¨ÓïÑÔÄÚÖõÄArray£¬»¹ÓоÍÊÇutilitiesÖÐÌṩµÄÈÝÆ÷Àà(container
classes)£¬ÓÖ³ÆȺ¼¯Àà(collection classes)¡£¼¯ºÏÔÚjavaÖзdz£ÖØÒª£¬ÔÚÌÖÂÛ֮ǰ£¬ÏÈÀ´¿´¼¸¸öÃæÊÔÖеľµäÎÊÌâ¡£
1 Collection ºÍ
CollectionsµÄÇø±ð¡£
2 List, Set, MapÊÇ·ñ¼Ì³Ð×ÔCollection½Ó¿Ú¡£
3 ArrayListºÍVectorµÄÇø±ð¡£
4 HashMapºÍHashtableµÄÇø±ð¡£
ƪβÓд𰸣¬ÎÒÃÇ¿ªÊ¼ÕýÌâ¡£
¼¯ºÏCollection½Ó¿Ú
--Collection ÊÇÈκζÔÏó×飬ԪËظ÷×Ô¶ÀÁ¢£¬Í¨³£ÓµÓÐÏàͬµÄÌ×ÓùæÔò¡£Set ListÓÉËüÅÉÉú¡£
»ù±¾²Ù×÷ Ôö¼ÓÔªËØadd(Object
obj); addAll(Collection c);
ɾ³ýÔªËØ
remove(Object obj); removeAll(Collection c);
Çó½»¼¯ retainAll(Collection
c);
ɾ³ýÔªËØ
remove(Object obj); removeAll(Collection c);
Çó½»¼¯
retainAll(Collection c);
·ÃÎÊ/±éÀú¼¯ºÏÔªËصĺð취ÊÇʹÓÃIterator½Ó¿Ú(µü´úÆ÷ÓÃÓÚÈ¡´úEnumeration)
Public interface Iterator{
¡¡ Public Boolean
hasNext(};
¡¡
Public Object next(};
¡¡Public void remove(};
}
¼¯set
--ûÓÐÖظ´ÏîÄ¿µÄ¼¯ºÏ
ÓÐÈýÖÖÌض¨ÀàÐ͵ļ¯¿ÉÓÃ
HashSet-»ùÓÚÉ¢ÁбíµÄ¼¯£¬¼Ó½øÉ¢ÁбíµÄÔªËØҪʵÏÖhashCode()·½·¨
LinkedHashSet-¶Ô¼¯µü´úʱ£¬°´Ôö¼Ó˳Ðò·µ»ØÔªËØ
TreeSet-»ùÓÚ£¨Æ½ºâ£©Ê÷µÄÊý¾Ý½á¹¹
Çåµ¥List
--λÖÃÐÔ¼¯ºÏ¡£¼Ó½øÇåµ¥µÄÔªËØ¿ÉÒÔ¼ÓÔÚÇåµ¥ÖÐÌض¨Î»Öûò¼Óµ½Ä©Î²
ÓÐÁ½¸öÌض¨°æ±¾
ArrayList(Êý×é±í)-ÀàËÆÓÚVector£¬¶¼ÓÃÓÚËõ·ÅÊý×éά»¤¼¯ºÏ¡£Çø±ð£º
Ò».ͬ²½ÐÔ:VectorÊÇḬ̈߳²È«µÄ£¬Ò²¾ÍÊÇ˵ÊÇͬ²½µÄ£¬¶øArrayListÊÇÏß³ÌÐò²»°²È«µÄ£¬²»ÊÇͬ²½µÄ
¶þ.Êý¾ÝÔö³¤:µ±ÐèÒªÔö³¤Ê±,VectorĬÈÏÔö³¤ÎªÔÀ´Ò»Å࣬¶øArrayListÈ´ÊÇÔÀ´µÄÒ»°ë
LinkedList(Á´±í)-ÊÇË«ÏòÁ´±í£¬Ã¿¸ö½Úµã¶¼ÓÐÁ½¸öÖ¸ÕëÖ¸ÏòÉÏÒ»½ÚµãºÍÏÂÒ»½Úµã¡£
ÓÃÔÚFIFO£¬ÓÃaddList()¼ÓÈëÔªËØ
removeFirst()ɾ³ýÔªËØ
ÓÃÔÚFILO,ÓÃaddFirst()/removeLast()
ListIteratorÌṩ˫Ïò±éÀúnext()
previous()£¬¿Éɾ³ý¡
Ïà¹ØÎĵµ£º
ÎÒÏÖÔÚ¸øÄãÒ»¸öJAVAºÍJSPÖ®¼äµÄ¹Øϵ,ÒÔ¼°JAVAµÄÍêÕûÈÏʶ
JAVA·ÖΪJ2EE,J2SE.J2ME,ÏÂÃæ·Ö±ð½éÉÜ:
Ò».J2EE£ºJava 2 Platform Enterprise Edition ÆóÒµ°æ£¬ÓÃÓÚÆóÒµÓ¦Óã¬Ö§³Ö·Ö²¼Ê½²¿Êð¡£
J2EEƽ̨ÓÉÒ»ÕûÌ×·þÎñ£¨Services£©¡¢Ó¦ÓóÌÐò½Ó¿Ú£¨APIs£©ºÍÐÒé¹¹³É£¬
Ëü¶Ô¿ª·¢»ùÓÚWebµÄ¶à²ãÓ¦ÓÃÌṩÁ˹¦ÄÜÉϵÄÖ§³Ö¡£Ëü°ü ......
×î½üÓöµ½ÁËÒ»¸öÎÊÌ⣬¾ÍÊÇÔÚÓõ½List.toArray ·½·¨Ê±£¬·µ»ØObject[]Êý×飬ֱ½Ó°ÑËüǿת³ÉÆäËûÀàÐ͵Ļᱨ´í£º
code: ArrayList list=getList();
String[] s=(String[])list.toArray();
except ......
JAVAÏà¹Ø»ù´¡ÖªÊ¶
1¡¢ÃæÏò¶ÔÏóµÄÌØÕ÷ÓÐÄÄЩ·½Ãæ
1.³éÏó£º
³éÏó¾ÍÊǺöÂÔÒ»¸öÖ÷ÌâÖÐÓ뵱ǰĿ±êÎ޹صÄÄÇЩ·½Ã棬ÒÔ±ã¸ü³ä·ÖµØ×¢ÒâÓ뵱ǰĿ±êÓйصķ½Ãæ¡£³éÏó²¢²»´òËãÁ˽âÈ«²¿ÎÊÌ⣬¶øÖ»ÊÇÑ¡ÔñÆäÖеÄÒ»²¿·Ö£¬ÔÝʱ²»Óò¿·Öϸ½Ú¡£³éÏó°üÀ¨Á½¸ö·½Ã棬һÊǹý³Ì³éÏ󣬶þÊÇÊý¾Ý³éÏó¡£
2.¼Ì³Ð£º
¼Ì³ÐÊÇÒ»ÖÖÁª½áÀàµÄ²ã ......
Java Learning Path £¨Ò»£©¡¢¹¤¾ßƪ
Ò»¡¢ JDK (Java Development Kit)
JDKÊÇÕû¸öJavaµÄºËÐÄ£¬°üÀ¨ÁËJavaÔËÐл·¾³£¨Java Runtime Envirnment£©£¬Ò»¶ÑJava¹¤¾ßºÍJava»ù´¡µÄÀà¿â(rt.jar)¡£²»ÂÛʲôJavaÓ¦Ó÷þÎñÆ÷ʵÖʶ¼ÊÇÄÚÖÃÁËij¸ö°æ±¾µÄJDK¡£Òò´ËÕÆÎÕJDKÊÇѧºÃJavaµÄµÚÒ»²½¡£×îÖ÷Á÷µÄJDKÊÇSun¹«Ë¾·¢²¼µÄJDK£¬³ýÁËSunÖ®Íâ ......
Õ⼸ÌìµÄѧϰ ÈÃÎҸе½·¢ã£¬ÀÏʦ½²µÄºÜ¶à£¬×Ô¼º¾Í¸ù±¾ÎÞ·¨È¥Ë¼¿¼£¬Ö»ÄÜÒ»¸ö¾¢µÄÍùÀïÌý£¬×Ô¼º´úÂëÒ²²»Ôõô»á£¬ÀÏʦ½²¹ýµÄÄÜÓиöÓ¡Ïó£¬ ²»¹ý½ñÌ컹ºÃ£¬½²µ½ÁËJava»ù´¡¼ÓÇ¿£¬ÉÔ΢¸Ð¾õºÃµã£¬²¢²»ÊǺÜÄÑÀí½âÁË£¬½ñÌì¾Í¿ªÊ¼½ñÌì¿Î³ÌµÄ¸´Ï°ÁË£¬ÒªÏë½ø²½£¬Ö»ÓÐ×Ô¼º¼è¿àŬÁ¦À²£¡
È· ......