JavaÖÐReadOnlyµÄ¼¯ºÏ
½ñÌìÔÚCSDN¹äÂÛ̳µÄʱºòÎÞÒâÖз¢ÏÖÓÐÈËÎÊÔÚJavaÖÐÊÇ·ñÓÐReadOnly²Ù×÷·½Ê½µÄ¼¯ºÏ£¬ËµÊµ»°ÔÚÒÔÍù¿ª·¢Öи÷ÖÖ¼¯ºÏÓõĺܶ࣬µ«ÊÇÕâ¸öÎÊÌ⻹ÕæûÓÐ×¢Òâ¹ý¡£È¥JavaµÄ¹Ù·½APIÎĵµ²éÁËһϣ¬CollectionsÖл¹ÕæÓÐÕâô¸ö·½·¨Ö§³Ö£¬·½·¨ÔÐÍÈçÏ£º
unmodifiableCollection
public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c)
·µ»ØÖ¸¶¨ collection µÄ²»¿ÉÐÞ¸ÄÊÓͼ¡£´Ë·½·¨ÔÊÐíÄ£¿éΪÓû§Ìṩ¶ÔÄÚ²¿ collection µÄ“Ö»¶Á”·ÃÎÊ¡£ÔÚ·µ»ØµÄ collection ÉÏÖ´ÐеIJéѯ²Ù×÷½«“¶ÁÍê”Ö¸¶¨µÄ collection¡£ÊÔͼÐ޸ķµ»ØµÄ collection£¨²»¹ÜÊÇÖ±½ÓÐ޸Ļ¹ÊÇͨ¹ýÆäµü´úÆ÷½øÐÐÐ޸ģ©½«µ¼ÖÂÅ׳ö UnsupportedOperationException¡£
·µ»ØµÄ collection ²»»á ½« hashCode ºÍ equals ²Ù×÷´«µÝ¸øµ×²ãʵÏÖ collection£¬µ«ÕâÒÀÀµÓÚ Object µÄ equals ºÍ hashCode ·½·¨¡£ÔڵײãʵÏÖ collection ÊÇÒ»¸ö set »òÊÇÒ»¸öÁбíµÄÇé¿öÏ£¬ÓбØÒª×ñÊØÕâЩ²Ù×÷µÄж¨¡£
Èç¹ûÖ¸¶¨ collection ÊÇ¿ÉÐòÁл¯µÄ£¬Ôò·µ»ØµÄ collection Ò²½«ÊÇ¿ÉÐòÁл¯µÄ¡£
²ÎÊý£º c - ½«ÎªÆä·µ»ØÒ»¸ö²»¿ÉÐÞ¸ÄÊÓͼµÄ collection¡£ ·µ»Ø£º Ö¸¶¨ collection µÄ²»¿ÉÐÞ¸ÄÊÓͼ¡£
¿´À´¾³£¹äCSDNÂÛ̳»¹ÊÇͦÓÐÊÕ»ñµÄ¡£^_^
Ïà¹ØÎĵµ£º
˵À´Í´¿à£¬¹ØÓÚjava°ü½á¹¹£¬´ò°ü£¬±àÒ룬ÔËÐеÄ֪ʶ£¬ÎÒÊÇѧÁËÍü£¬ÍüÁËѧ¡£ËäÈ»¾ø´ó²¿·Ö¿ª·¢»ùÓÚ¶ÔIDEµÄʹÓ㬲¢ÇÒºÜˬ£¬µ«Ã¿´Î»Ø¹éÃüÁîÐÐģʽʱ£¬ÓÉÓÚȱ·¦¶Ôjava°ü½á¹¹¡¢´ò°ü¡¢±àÒë¡¢ÔËÐÐÏà¹ØµÄ֪ʶ×ܽἰÊìÁ·ÔËÓ㬿Éν´ç²½ÄÑÐÐ
ÍøÉÏËäȻɢ²¼ºÜ¶à¹ØÓÚÕâ·½ÃæµÄÂÛÊö£¬µ«×ܸоõ²»·ûºÏÎÒµÄÇÐÉíʵ¼Ê
¿´À´£¬×Ô¼º¶¯ÊÖ¹éÄÉ×ܽᣠ......
ÔÚJava±àд¾ßÓÐÁ¬¹á±ä»¯µÄ´°¿Ú³ÌÐòʱ£¬Í¨³£µÄ°ì·¨ÊÇÔÚ×ÓÀàÖи²¸Ç¸¸ÀàµÄpaint(Graphics)·½·¨£¬ÔÚ·½·¨ÖÐʹÓÃGUIº¯ÊýʵÏÖ´°¿ÚÖØ»æµÄ¹ý³Ì¡£Á¬¹á±ä»»µÄ´°¿Ú»á²»¶ÏµØµ÷ÓÃupdate(Graphics)º¯Êý£¬¸Ãº¯Êý×Ô¶¯µÄµ÷ÓÃpaint(Graphics)º¯Êý¡£ÕâÑù¾Í»á³öÏÖÉÁ˸µÄÇé¿ö¡£
ΪÁ˽â¾öÕâÒ»ÎÊÌ⣬¿ÉÒÔÓ¦ÓÃË«»º³å¼¼Êõ¡£¿ÉÒÔͨ¹ý½ØÈ¡ÉÏÊö¹ý³Ì£¬¸ ......
×÷ΪJava³ÌÐòÔ±À´Ëµ£¬×îÍ´¿àµÄÊÂÇéĪ¹ýÓÚ¿ÉÒÔÑ¡ÔñµÄ·¶Î§Ì«¹ã£¬¿ÉÒÔ¶ÁµÄÊéÌ«¶à£¬ÍùÍùÈÝÒ×ÎÞËùÊÊ´Ó¡£ÎÒÏë¾ÍÎÒ×Ô¼º¶Á¹ýµÄ¼¼ÊõÊé¼®ÖÐÌôÑ¡³öÀ´Ò»Ð©£¬°´ÕÕѧϰµÄÏȺó˳Ðò£¬ÍƼö¸ø´ó¼Ò£¬ÌرðÊÇÄÇЩÏë²»¶ÏÌá¸ß×Ô¼º¼¼ÊõˮƽµÄJava³ÌÐòÔ±ÃÇ¡£
Ò»¡¢Java±à³ÌÈëÃÅÀà
¶ÔÓÚûÓÐJava±à³Ì¾ÑéµÄ³ÌÐòÔ±ÒªÈëÃÅ£¬Ëæ±ã¶ÁʲôÈëÃÅÊé¼®¶¼Ò»Ñù£¬Õâ ......
Ç°ÃæÒѾ·ÖÎöÁËjavaÃüÁî¼ÓÔØjavaÐéÄâ»úµÄ·½·¨£¬¼´Í¨¹ýJNIºÍÐéÄâ»ú½»»¥¡£Òò´ËÎÒÃÇ¿ÉÒÔºÜÈÝÒ×µÄ×Ô¼ºÐ´ÏàÓ¦µÄÆô¶¯´úÂ룬ʵÏÖÔÚC++³ÌÐòÖÐÖ´ÐÐjava³ÌÐò£¬µ÷ÓÃjavaÀàµÄ·½·¨¡£
Òª²âÊÔµÄJavaÀà(Test.java)µÄ´úÂëÊÇ£º
public class Test {
public Test( ......
ÎÒÊÇ2000Äê´óѧ±ÏÒµ,ÔÚѧУѧµÄÊǾ¼Ãרҵ,±ÏÒµºó×öJAVAÈí¼þ¿ª·¢.
ÏàÐźܶà×ö¼¼ÊõµÄÅóÓѶ¼ÊÇ´ÓÆäËûÐÐҵת¹ýÀ´µÄ
ew roman';">,ѧϰ±à³ÌµÄ¹ý³ÌºÍ¾Ñé¸÷²»Ò»Ñù,ÎÒ½«×Ô¼ºµÄ´ÓÒµ¾ÀúдÁ˳öÀ´,Çë¼û:
http://www.jobhotel.com.cn/yourbay/news-2.jsp?id=15353
......