Java ÖÐ Vector¡¢ArrayList¡¢List ʹÓÃÉîÈëÆÊÎö
ÏßÐÔ±í£¬Á´±í£¬¹þÏ£±íÊ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£©»òË«Ïò¶ÓÁÐ
Ïà¹ØÎĵµ£º
Ëæ×Å»¥ÁªÍøµÄÈÕÒæ׳´ó,ÍøÕ¾µÄpvºÍuv³ÉÏßÐÔ»òÕßÖ¸Êý±¶µÄÔö¼Ó.µ¥·þÎñÆ÷µ¥Êý¾Ý¿âÔçÒѾ²»ÄÜÂú×ãʵ¼ÊÐèÇó.±ÈÈçÏñÊ¢´ó,ÌÔ±¦ÕâÑùµÄ´óÐÍÍøÂ繫˾,¸üÊÇÈç´Ë.
¼¯Èº,Ò²¾ÍÊÇÈÃÒ»×é¼ÆËã»ú·þÎñÆ÷Ðͬ¹¤×÷,´ï½â¾ö´ó²¢·¢,´óÊý¾ÝÁ¿Æ¿¾±ÎÊÌâ.µ«ÊÇÔÚȺ¼¯ÖÐ,sessionÍùÍùÊÇÒ»¸ö±È½ÈÍ·ÌÛµÄÎ ......
½ñÍíÔÚ¹äCSDNµÄʱºò·¢ÏÖÁË£¬ÓÐÈËÓÃjavaдÁËÉú³Émyeclipse×¢²áÂëµÄ´úÂ룬ËùÒԾͳ¼ÁËÏÂÀ´¡£ o(∩_∩)o ¹þ¹þ
package gggg;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
public class MyEclipseGen {
private static final ......
1.¶ÁÈ¡XMLÎļþµÄÀࣺ
public class XMLUtils {
private final String DB_XML_FILE = "/XMLSetting.xml";
public Properties getPropertiesfromXML() {
URL url = XMLUtils.class.getResource(dBXMLFILE);
URI uri;
try {
uri = url.toURI();
InputSource xmlfile = new InputSource(uri.g ......
Runtime runtime = Runtime.getRuntime();// ¿ªÊ¼µ÷Ó÷þÎñ¶Ë½Å±¾
Process process = runtime.exec("encode.sh /home/tomcat6/kgedata/note_not_encode/ /home/tomcat6/kgedata/note_encode/");
int exitVal = process.waitFor();
System.out.prin ......
1.Java ÐòÁл¯¼¼Êõ¿ÉÒÔʹÄ㽫һ¸ö¶ÔÏóµÄ״̬дÈëÒ»¸öByte Á÷À²¢ÇÒ¿ÉÒÔ´ÓÆäËüµØ·½
°Ñ¸ÃByte Á÷ÀïµÄÊý¾Ý¶Á³öÀ´¡£ÖØй¹ÔìÒ»¸öÏàͬµÄ¶ÔÏó¡£ÕâÖÖ»úÖÆÔÊÐíÄ㽫¶ÔÏóͨ¹ýÍøÂç
½øÐд«²¥£¬²¢¿ÉÒÔËæʱ°Ñ¶ÔÏó³Ö¾Ã»¯µ½Êý¾Ý¿â¡¢ÎļþµÈϵͳÀï¡£JavaµÄÐòÁл¯»úÖÆÊÇRMI¡¢
EJB¡¢JNNIµÈ¼¼ÊõµÄ¼¼Êõ»ù´¡
2.²¢·ÇËùÓеÄJava À඼¿ÉÒÔÐòÁл¯ ......