JavaÖÐSetµÄÉîÈëÑо¿
SetºÍÊýѧÖеļ¯ºÏÊÇͬһ¸ö¸ÅÄ¾ÍÊÇûÓÐÖظ´ÔªËصļ¯ºÏ¡£
ÕâƪÎÄÕÂÖ÷ÒªÂÛÊöÁËSetÊÇÈçºÎʵÏÖ"ûÓÐÖظ´ÔªËØ"£¨no duplicate elements£©µÄ£¬ÒÔ¼°²ûÊöÁËʲôÊÇ“Öظ´”£¨duplicate£©£¬ÊÇÏàͬµÄµØÖ·¿Õ¼ä£¿ÊÇequalsµÄ·µ»ØֵΪtrue£¿ÊÇcompareToµÄ·µ»ØֵΪ0 £¿»¹ÊÇÓÐÏàͬµÄhashCode£¿±¾ÎÄ»¹¸ø³öÁËÔÚʲôÇé¿öÏÂʹÓÃʲôÑùµÄSetµÄ½¨Òé¡£
×¢£º±¾ÎIJ»Éæ¼°·¶ÐÍ¡£
1¡¢Ê÷Ðνṹ£º
public interface Set extends Collection{}
public abstract class AbstractSet extends AbstractCollection implements Set{}
public class CopyOnWriteArraySetextends AbstractSetimplements Serializable{}
public abstract class EnumSet>extends AbstractSetimplements Cloneable, Serializable{}
public class HashSetextends AbstractSetimplements Set, Cloneable, Serializable{}
public final class JobStateReasonsextends HashSetimplements PrintJobAttribute{}
public class LinkedHashSetextends HashSetimplements Set, Cloneable, Serializable{}
public class TreeSetextends AbstractSetimplements SortedSet, Cloneable, Serializable{}
¿ÉÒÔ¿´³ö£¬¿ÉÒÔʵÀý»¯µÄÀàΪ£ºCopyOnWriteArraySet£¬HashSet£¬LinkedHashSet£¬TreeSet¡£
2¡¢SetÊÇÈçºÎʵÏÖÔªËØΨһÐÔµÄ
javadocÖжÔSetµÄÃèÊöµÚÒ»¶ÎÈçÏ£º“A collection that contains no duplicate elements. More formally, sets contain no pair of elements e1
and e2 such that e1.equals(e2), and at most one null element. As implied by its name, this interface models the mathematical set abstraction.”
Õâ¶Î»°ÊǶÔÊÇ´í£¬Çë¿´ÏÂÃæ·ÖÎö¡£
Òª½øÐÐÏÂÃæµÄÂÛÊö£¬ÎÒÃÇÏÈÁ˽âÒ»ÏÂMap¡£MapÖеÄÔªËØÊÇ“¼ü£Öµ”¶Ô£¬ÆäÖГ¼ü”±ØÐëÊÇΨһµÄ¡£TreeSetºÍHashSet¾ÍÊÇÀûÓÃÕâ¸öÌØÐÔʵÏÖ“no duplicate elements”¡£Ëü°ÑsetÖеÄÔªËØ×÷ΪMapÖеē¼ü”£¬´Ó¶ø±£³ÖÔªËصÄΨһÐÔ¡£ÕâЩ¼üÔÚMapÖÐÓÖÊÇÈçºÎÇø·ÖµÄÄØ£¿²»Í¬µÄMapÓв»Í¬µÄ×ö·¨£¬¶øÇÒÇø±ðºÜ´ó¡£
ÏÂÃæÎÒÃÇ·Ö±ð¾ÍTreeSet¡¢HashSetºÍCopyOnWriteArraySet½øÐÐÂÛÊö£º
2.1¡¢TreeSet²¿·Ö£º
ÒÔÏÂÒÔTreeSetΪÀý½øÐзÖÎö¡£
Çë¿´TreeSetµÄ²¿·ÖʵÌ壺
public class TreeSet extends AbstractSet
implements SortedSet, Cloneable, java.io.Ser
Ïà¹ØÎĵµ£º
JavaÓïÑÔµÄÊäÈëÊä³ö¹¦ÄÜÊÇÊ®·ÖÇ¿´ó¶øÁé»îµÄ£¬ÃÀÖв»×ãµÄÊÇ¿´ÉÏÈ¥ÊäÈëÊä³öµÄ´úÂë²¢²»ÊǺܼò½à£¬ÒòΪÄãÍùÍùÐèÒª°ü×°Ðí¶à²»Í¬µÄ¶ÔÏó¡£ÔÚJavaÀà¿âÖУ¬IO²¿·ÖµÄÄÚÈÝÊǺÜÅÓ´óµÄ£¬ÒòΪËüÉæ¼°µÄÁìÓòºÜ¹ã·º:±ê×¼ÊäÈëÊä³ö£¬ÎļþµÄ²Ù×÷£¬ÍøÂçÉϵÄÊý¾ÝÁ÷£¬×Ö·û´®Á÷£¬¶ÔÏóÁ÷£¬zipÎļþÁ÷....±¾ÎĵÄÄ¿µÄÊÇΪ´ó¼Ò×öÒ»¸ö¼òÒªµÄ½éÉÜ¡£
......
×î³õÎÒÃÇÓà Java д JSP µÄʱºò£¬¼¸ºõ¿ÉÒÔ²»´¥¼°Òì³££¬ÒòΪ Servlet ÈÝÆ÷»á°Ñ API Å׳öµÄÒì³£°ü×°³É
ServletException ¶ª¸øÈÝÆ÷È¥´¦Àí¡£ÔÙºóÀ´Ó¦Ó÷ֲ㣬´úÂëÖÐÒª´¦ÀíµÄÒì³£±ã¶àÁË£¬Ò»°ã»áת»»³É×Ô¶¨ÒåµÄÒµÎñÒì³£À࣬ÓÃ
try-catch-throw
customerException-finally¡£ÔÙµ½Èç½ñ¸÷ÖÖ¿ò¼ÜÈÕÕé³ÉÊ죬´úÂëÖÐÏÔʽµÄÒì³£´¦ÀíÓÖ½¥ ......
JavaÊý¾Ý¿âÁ¬½Ó£¨JDBC£©ÓÉÒ»×éÓà Java ±à³ÌÓïÑÔ±àдµÄÀàºÍ½Ó¿Ú×é³É¡£JDBC Ϊ¹¤¾ß/Êý¾Ý¿â¿ª·¢ÈËÔ±ÌṩÁËÒ»¸ö±ê×¼µÄ API£¬Ê¹ËûÃÇÄܹ»Óô¿Java API À´±àдÊý¾Ý¿âÓ¦ÓóÌÐò¡£È»¶ø¸÷¸ö¿ª·¢É̵Ľӿڲ¢²»ÍêÈ«Ïàͬ£¬ËùÒÔ¿ª·¢»·¾³µÄ±ä»¯»á´øÀ´Ò»¶¨µÄÅäÖñ仯¡£±¾ÎÄÖ÷Òª¼¯ºÏÁ˲»Í¬Êý¾Ý¿âµÄÁ¬½Ó·½Ê½¡£
¡¡¡¡Ò»¡¢Á¬½Ó¸÷ÖÖÊý¾Ý¿ ......
±àдһ¸ö¼òµ¥µÄÎı¾±à¼Æ÷£¬ÒªÇ󣺾ßÓдò¿ª¡¢±£´æ¡¢Ð½¨£¬Õ³Ìù¡¢¸´ÖƵȹ¦ÄÜ£»¾ßÓÐÒ»¸ö¹¤¾ßÌõ¡£±àдһ¸öÀàËÆ Windows ¼Çʱ¾µÄ¼òµ¥³ÌÐò£¬¸Ã³ÌÐòÄܹ»´´½¨ÐÂÎļþ¡¢¶ÁÈ¡ÒѾ´æÔÚµÄÎļþ¡¢²é¿´ºÍÐÞ¸ÄÎı¾ÒÔ¼°±£´æΪÎı¾Îļþ¡£
ÔÝʱ»¹²»»á×ö£¬Å¬Á¦ÖС£¡£¡£¡£¡£¡£¡£¡£ ......