javaÊý¾Ý½á¹¹ ÏßÐÔ±í£¬Á´±í£¬¹þÏ£±í
ÏßÐÔ±í£¬Á´±í£¬¹þÏ£±íÊdz£ÓõÄÊý¾Ý½á¹¹£¬ÔÚ½øÐÐJava¿ª·¢Ê±£¬JDKÒѾΪÎÒÃÇÌṩÁËһϵÁÐÏàÓ¦µÄÀàÀ´ÊµÏÖ»ù±¾µÄÊý¾Ý½á¹¹¡£ÕâЩÀà¾ùÔÚjava.util°üÖС£±¾ÎÄÊÔͼͨ¹ý¼òµ¥µÄÃèÊö£¬Ïò¶ÁÕß²ûÊö¸÷¸öÀàµÄ×÷ÓÃÒÔ¼°ÈçºÎÕýȷʹÓÃÕâЩÀà¡£
<o:p></o:p>
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
<o:p></o:p>
Collection½Ó¿Ú
¡¡¡¡CollectionÊÇ×î»ù±¾µÄ¼¯ºÏ½Ó¿Ú£¬Ò»¸öCollection´ú±íÒ»×éObject£¬¼´CollectionµÄÔªËØ£¨Elements£©¡£Ò»Ð©CollectionÔÊÐíÏàͬµÄÔªËضøÁíһЩ²»ÐС£Ò»Ð©ÄÜÅÅÐò¶øÁíһЩ²»ÐС£Java SDK²»Ìṩֱ½Ó¼Ì³Ð×ÔCollectionµÄÀ࣬Java SDKÌṩµÄÀ඼ÊǼ̳Ð×ÔCollectionµÄ“×Ó½Ó¿Ú”ÈçListºÍSet¡£
¡¡¡¡ËùÓÐʵÏÖCollection½Ó¿ÚµÄÀ඼±ØÐëÌṩÁ½¸ö±ê×¼µÄ¹¹Ô캯Êý£ºÎÞ²ÎÊýµÄ¹¹Ô캯ÊýÓÃÓÚ´´½¨Ò»¸ö¿ÕµÄCollection£¬ÓÐÒ»¸öCollection²ÎÊýµÄ¹¹Ô캯ÊýÓÃÓÚ´´½¨Ò»¸öеÄCollection£¬Õâ¸öеÄCollectionÓë´«ÈëµÄCollectionÓÐÏàͬµÄÔªËØ¡£ºóÒ»¸ö¹¹Ô캯ÊýÔÊÐíÓû§¸´ÖÆÒ»¸öCollection¡£
¡¡¡¡ÈçºÎ±éÀúCollectionÖеÄÿһ¸öÔªËØ£¿²»ÂÛCollectionµÄʵ¼ÊÀàÐÍÈçºÎ£¬Ëü¶¼Ö§³ÖÒ»¸öiterator()µÄ·½·¨£¬¸Ã·½·¨·µ»ØÒ»¸öµü´ú×Ó£¬Ê¹Óøõü´ú×Ó¼´¿ÉÖðÒ»·ÃÎÊCollectionÖÐÿһ¸öÔªËØ¡£µäÐ͵ÄÓ÷¨ÈçÏ£º
¡¡¡¡¡¡¡¡Iterator it = collection.iterator(); // »ñµÃÒ»¸öµü´ú×Ó
¡¡¡¡¡¡¡¡while(it.hasNext()) {
¡¡¡¡¡¡¡¡¡¡¡¡Object obj = it.next(); // µÃµ½ÏÂÒ»¸öÔªËØ
¡¡¡¡¡¡¡¡}
¡¡¡¡ÓÉCollection½Ó¿ÚÅÉÉúµÄÁ½¸ö½Ó¿ÚÊÇListºÍSet¡£
Ö÷Òª·½·¨:<o:p></o:p>
boolean add(Object o)Ìí¼Ó¶ÔÏóµ½¼¯ºÏ
boolean remove(Object o)ɾ³ýÖ¸¶¨µÄ¶ÔÏó
int size()·µ»Øµ±Ç°¼¯ºÏÖÐÔªËصÄÊýÁ¿
boolean contains(Object o)²éÕÒ¼¯ºÏÖÐÊÇ·ñÓÐÖ¸¶¨µÄ¶ÔÏó
boolean isEmpty()Åжϼ¯ºÏÊÇ·ñΪ¿Õ
Iterator iterator()·µ»ØÒ»¸öµü´úÆ÷
boolean containsAll(Collection c)²éÕÒ¼¯ºÏÖÐÊÇ·ñÓм¯ºÏcÖеÄÔªËØ<o:p></o:p>
boolean addAll(Collection c)½«¼¯ºÏcÖÐËùÓеÄÔªËØÌí¼Ó¸ø¸Ã¼¯ºÏ<o:p></o:p>
void clear()ɾ³ý¼¯ºÏÖÐËùÓÐÔªËØ<o:p></o:p>
void removeAll(Collection c)´Ó¼¯ºÏÖÐɾ³ýc¼¯ºÏÖÐÒ²ÓеÄÔªËØ<o:p></o:p>
void retainAll(Collection c)´Ó¼¯ºÏÖÐɾ³ý¼¯ºÏcÖв»°üº¬µÄÔªËØ<o:p></o:p>
Ïà¹ØÎĵµ£º
JavaÖ´ÐÐstm.executeQuery(sql); ʱ×ÜÊÇÌáʾ£ºjava.sql.SQLException: ORA-00911: ÎÞЧ×Ö·û£¬ÅªÁË°ëÌ컹Êdzö´í£¬ÎÞÄΣ¬ÄóöɱÊÖïµ£¬Googleһϣ¬Ôε¹£¬·¢ÏÖÎÒµÄString sql = “select detail from test.result where person_id = 4; "£¬Ã²ËÆû´íÎó°É£¬½á¹ûÎÒÎÒ±ØÐëÈ¥µô×îºó·ÖºÅ£¬±¾À´ÊÇÏë¸ãµÃרҵµã£¬¾Í¼Û¼Ó¸ö·Ö ......
±³¾°¼ò½é£ºKMPËã·¨ÓÃÀ´´¦Àí×Ö·û´®Æ¥ÅäµÄ¡£¸øÄãA,BÁ½¸ö×Ö·û´®£¬¼ì²éB´®ÊÇ·ñÊÇA´®µÄ×Ó´®£¬ÀàËÆÓÚJavaµÄString.indexOf("")¡£Ö®ËùÒÔ½Ð×öKMP£¬ÊÇÒòΪÕâ¸öËã·¨ÊÇÓÉKnuth¡¢Morris¡¢PrattÈý¸öÌá³öÀ´µÄ£¬È¡ÁËÕâÈý¸öÈ˵ÄÃû×ÖµÄÍ·Ò»¸ö×Öĸ¡£
ÔÀí½éÉÜ£ºÕÒµ½Æ¥Åäʧ°ÜʱµÄ×îºÏÊʵĻØÍËλÖ㬶ø²»ÊǼòµ¥µÄ»ØÍ˵½×Ó´®µÄµÚÒ»¸ö×Ö·û£¨³£¹ ......
Õâ²»ÊÇʲô½Ì²Ä£¬±ÊÕßÓÐʱ»áÔÚÂÛ̳ÉÏÇÆÇÆ£¬¿´µ½²»ÉÙ³õѧÕßÎʵ½ºÜ¶àÎÊÌ⣬ÕâЩÎÊÌâÊÇjava³ÌÐòÔ±Ó¦¸Ã¶®µÃµÄ£¬¶øÒ»°ãÊéÉϲ»»á½²µ½»òÕßÒ»±Ê´ø¹ýµÄ֪ʶ¡£Òò´Ë¶·µ¨Í¿Ñ»Ò»ÆªÎÄÕ£¬°ÑÏë˵µÄÔÚÕâÀïÒ»¿ÚÆø˵Íê¡£ÕâÒ²ÊDZ¾È˵ÚÒ»´Îд¼¼ÊõÐÔµÄÎÄÕ£¬Îıʲ»³©Ö®Í⣬»¹Çë¸÷λ¼ûÁ¡£
Ê×ÏȽ²Çå³þÀàºÍ¶ÔÏóµÄÇø±ð¡£
ÀàÊǹ㷺µÄ¸ÅÄ±íʾһ¸ö ......
public class DealLockTest implements Runnable {
static String i = new String();
static String j = new String();
private String str = null;
public DealLockTest(String str) {
this.str = str;
}
public static void main(String[] args) {
new Thread(new DealLockTest("i")).start( ......
ÏÈÉùÃ÷һϣ¬ÌâÄ¿Ô³öÓÚ£ºhttp://gocom.primeton.com/modules/newbb/item60284_60284.htm
JVMÊÇJava³ÌÐòµÄÔËÐл·¾³£¬Òò´Ë¶ÔÓÚJVMµÄÕÆÎÕÓÐÖúÓÚÀí½âJava³ÌÐòµÄÖ´ÐÐÒÔ¼°±àд£¬ÓÈÆäÊÇÔËÐÐʱÅöµ½µÄһЩ¹îÒìÎÊÌ⣬ÄÇôÔõôÑùÄÜ¿¼²ì×Ô¼º¶ÔÓÚJVM¹Ø¼ü֪ʶµãµÄÕÆÎÕÇé¿ö£¬°ïÖúѧϰJVM»úÖÆÄØ£¬ÔÚÕâƪblogÖÐÀ´Ì½ÌÖÏ¡£
¶ÔÓÚJava³ÌÐò¶øÑ ......