JavaµÄÈÝÆ÷ÀàVector¡¢ArrayList¡¢HashTableµÈ
ÏßÐÔ±í£¬Á´±í£¬¹þÏ£±íÊdz£ÓõÄÊý¾Ý½á¹¹£¬ÔÚ½øÐÐJava¿ª·¢Ê±£¬JDKÒѾΪÎÒÃÇÌṩÁËһϵÁÐÏàÓ¦µÄÀàÀ´ÊµÏÖ»ù±¾µÄÊý¾Ý½á¹¹¡£ÕâЩÀà¾ùÔÚjava.util°üÖС£±¾ÎÄÊÔͼͨ¹ý¼òµ¥µÄÃèÊö£¬Ïò¶ÁÕß²ûÊö¸÷¸öÀàµÄ×÷ÓÃÒÔ¼°ÈçºÎÕýȷʹÓÃÕâЩÀà¡£
Collection
©ÀList
©¦©ÀLinkedList
©¦©ÀArrayList
©¦©¸Vector
©¦¡¡©¸Stack
©¸Set
Map
©ÀHashtable
©ÀHashMap
©¸WeakHashMap
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¡£
List½Ó¿Ú
ListÊÇÓÐÐòµÄCollection£¬Ê¹Óô˽ӿÚÄܹ»¾«È·µÄ¿ØÖÆÿ¸öÔªËزåÈëµÄλÖá£Óû§Äܹ»Ê¹ÓÃË÷Òý£¨ÔªËØÔÚListÖеÄλÖã¬ÀàËÆÓÚÊý×éϱ꣩À´·ÃÎÊListÖеÄÔªËØ£¬ÕâÀàËÆÓÚJavaµÄÊý×é¡£
ºÍÏÂÃæÒªÌáµ½µÄSet²»Í¬£¬ListÔÊÐíÓÐÏàͬµÄÔªËØ¡£
³ýÁ˾ßÓÐCollection½Ó¿Ú±Ø±¸µÄiterator()·½·¨Í⣬List»¹Ìṩһ¸ölistIterator()·½·¨£¬·µ»ØÒ»¸ö ListIterator½Ó¿Ú£¬ºÍ±ê×¼µÄIterator½Ó¿ÚÏà±È£¬ListIterator¶àÁËһЩadd()Ö®ÀàµÄ·½·¨£¬ÔÊÐíÌí¼Ó£¬É¾³ý£¬É趨ԪËØ£¬»¹ÄÜÏòÇ°»òÏòºó±éÀú¡£
ʵÏÖList½Ó¿ÚµÄ³£ÓÃÀàÓÐLinkedList£¬ArrayList£¬VectorºÍStack¡£
LinkedListÀà
LinkedListʵÏÖÁËList½Ó¿Ú£¬ÔÊÐínullÔªËØ¡£´ËÍâLinkedListÌṩ¶îÍâµÄget£¬remove£¬insert·½·¨ÔÚ LinkedListµÄÊײ¿»òβ²¿¡£ÕâЩ²Ù×÷ʹLinkedList¿É±»ÓÃ×÷¶ÑÕ»£¨stack£©£¬¶ÓÁУ¨queue£©»òË«Ïò¶ÓÁУ¨deque£©¡£
×¢ÒâLinkedListûÓÐͬ²½·½·¨¡£Èç¹û¶à¸öÏß³Ìͬʱ·ÃÎÊÒ»¸öList£¬Ôò±ØÐ
Ïà¹ØÎĵµ£º
create PROCEDURE pagelist
@tablename nvarchar(50),
@fieldname nvarchar(50)='*',
@pagesize int output,--ÿҳÏÔʾ¼Ç¼ÌõÊý
@currentpage int output,--µÚ¼¸Ò³
@orderid nvarchar(50),--Ö÷¼üÅÅÐò
@sort int,--ÅÅÐò·½Ê½£¬1±íʾÉýÐò£¬0±íʾ½µÐòÅÅÁÐ
......
Reflection µÄ¼òµ¥Ó¦Ó㬰üÀ¨field£¬ method£¬constructorµÄÓ¦Óá£
package com.gaoqian.reflection;
import java.lang.reflect.Array;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Typ ......
±ÈÈçjavaÖг£ÓõÄÔËËã·û
Ò» ·ûºÅ++ ,+,--,-
ÓÐʱÕâ¸ö·ûºÅÆ´´ÕÆðÀ´Ò²Óе㸴ÔÓ
±ÈÈçÕâÑùÒ»¸öÔËËãʽ
int i=3;
i+++i-i++-++i
+ -ÔËËã·ûµÄÓÅÏȼ¶ µÍÓÚ++£¬-- ÏÈÔËËã++£¬--
¿ÉÒÔ½«ÉÏÃæµÄʽ×Ó²ð¿ª
i++ + i - i++ - ++i
ÕâÑùÊDz»ÊÇÈÝÒ׶àÁË
ÏÈÀ´¸ö¼òµ¥µãµÄ
1 K++
int k=0;
System.out.println(K++)
System.o ......
ÏÂÃ濪½²¹ÊÊ£º
´ÓÇ°Óиö·¿¼ä£¬·¿¼äÀïÓзÝÎĵµ£¬·¿¼ä»¹ÓÐÒ»°ÑÔ¿³×¡£ Õâ°ÑÔ¿³×ÔÚÕÅÈýÊÖÀï¡£
ÕâʱÀîËÄÀ´ÏòÕÅÈýÒªÄÇ·ÝÎĵµ¡£ ÕÅÈý²»Ì«Ï²»¶ÀîËÄ£¬µ«ÓÖŵ¢ÎóÁË
¹¤×÷²»ºÃ½»´ú¡£ÓÚÊÇÕÅÈý¾Í°Ñ·¿¼äÀïÎĵµµÄÎĵµ¸´Ó¡ÁËÒ»·Ý£¬È»ºó°ÑÄǸö¸´Ó¡¼þ½»¸øÁËÀîËÄ£¨Õâ½Ð´«Öµ£©¡£
ÀîËÄÄõ½Îĵµºó£¨¸´Ó¡¼þ£©£¬ºúÂÒÐÞ¸ÄÒ» ......