Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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Ïß³ÌÖ® InterruptedException Òì³£

 µ±Ò»¸ö·½·¨ºóÃæÉùÃ÷¿ÉÄÜ»áÅ׳öInterruptedException Ò쳣ʱ£¬ËµÃ÷¸Ã·½·¨ÊÇ¿ÉÄܻỨһµãʱ¼ä£¬µ«ÊÇ¿ÉÒÔÈ¡ÏûµÄ·½·¨¡£
Å×InterruptedExceptionµÄ´ú±í·½·¨ÓУº
1. java.lang.Object ÀàµÄ wait ·½·¨
2. java.lang.Thread ÀàµÄ sleep ·½·¨
3. java.lang.Thread ÀàµÄ join ·½·¨
-- ÐèÒª»¨µãʱ¼äµÄ·½·¨
Ö´ÐÐwait·½·¨µÄÏ ......

³¬ÇáÁ¿¼¶JAVA¿ª·¢·½·¨(Ò»)

      Ä¿Ç°ÒÔEclipseΪÖ÷µÄÖØÁ¿¼¶¿ª·¢¹¤¾ß´óÐÐÆäµÀ.ËäÈ»¼«Îª·½±ã.µ«Èí¼þ°²×°¶ÔÓÚϵͳÅäÖò»¸ßµÄµçÄÔ»òÕßСÏîÄ¿¿ª·¢·Ç³£²»Àû.ÔÚÒÆÖ²¹ý³ÌÖл¹ÓÐÅäÖÃÎÊÌâ.±È½ÏÂé·³.Òò´Ë¶ÔÓÚһЩ³¬Ð¡ÏîÄ¿,ʹÓÃÇáÁ¿¼¶µÄ¿ª·¢·½·¨,ÏÔµÃÓÉΪ±ØÒª.Ëùν³¬ÇáÁ¿¼¶,¾ÍÊÇÓÃ×î¼òµ¥µÄ¹¤¾ßÍê³ÉJAVAϵͳµÄ¿ª·¢.ÔÚ¿ª·¢µ±ÖÐÒ²¿ÉÒÔÁ˽â ......

javaÖÐList¼¯ºÏµÄʹÓÃ

 ÔÚJavaÖÐÈç¹ûList ½áºÏ´æÈ¡µÄÊÇÐí¶àÀàÐͲ»Í¬µÄÊý¾ÝÈçint,String ÀàÐͶ¼ÓУ¬ÄÇôÈçºÎʹÓÃJSTL±í´ïʽѭ»·»ñÈ¡List¼¯ºÏÖеÄÔªËØÄØ£¿
È磺¼ÙÈçList list=new ArrayList();    int a=1; String b="sss";    String c="ddddddd";……ÔÚServletÖРʹÓÃSession ±£´æ
session.set ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ