{"id":302,"date":"2007-05-07T18:10:23","date_gmt":"2007-05-07T10:10:23","guid":{"rendered":"http:\/\/www.jason695.idv.tw:81\/wordpress\/?p=302"},"modified":"2007-05-07T18:10:23","modified_gmt":"2007-05-07T10:10:23","slug":"%e5%90%84%e7%a8%ae-map-set-list","status":"publish","type":"post","link":"https:\/\/jason695.why3s.tw\/wordpress\/2007\/05\/07\/%e5%90%84%e7%a8%ae-map-set-list\/","title":{"rendered":"\u5404\u7a2e MAP SET LIST"},"content":{"rendered":"<p><span class=\"javascript\" id=\"text28127\"><font color=\"blue\">\u4ee5\u4e0b\u6587\u7ae0\u91cd\u65b0\u6574\u7406\u5404\u4f4d\u5927\u5927\u6240\u63d0\u4f9b\u7684\u8cc7\u6599<\/font><\/p>\n<p><font color=\"red\">Collections =&gt;<\/font>  Collection\u662f\u6240\u6709List\u8ddfSet\u7684\u59cb\u7956\uff0cList\u5fc5\u9808\u4ee5\u7279\u5b9a\u6b21\u5e8f\u4f86\u6301\u6709\u7269\u4ef6\uff0cSet\u7121\u6cd5\u64c1\u6709\u91cd\u8907\u5143\u7d20<br \/>\n========================<br \/>\n<font color=\"red\">ArrayList =&gt;<\/font>  \u7528Array\u5be6\u505a\u7684List\uff0c\u5141\u8a31\u5feb\u901f\u96a8\u6a5f\u5b58\u53d6\uff0c\u76f8\u8f03\u65bcLinkedList \u4e0d\u9069\u5408\u62ff\u4f86\u9032\u884c\u5143\u7d20\u5b89\u63d2\u548c\u79fb\u9664\u52d5\u4f5c<br \/>\n<font color=\"red\">LinkedList =&gt; <\/font>\u63d0\u4f9b\u6700\u4f73\u5faa\u5e8f\u5b58\u53d6\uff0c\u9069\u5408\u5b89\u63d2\u548c\u79fb\u9664\u5143\u7d20\uff0c\u96a8\u6a5f\u5b58\u53d6\u52d5\u4f5c\u6bd4\u8d77ArrayList\u7de9\u6162<br \/>\n========================<br \/>\n<font color=\"red\">HashSet =&gt;  <\/font>\u662f\u4e00\u7a2ecollection\uff0c\u4f46\u662f\u53ea\u5b58\u653e\u552f\u4e00\u503c\uff0c\u662f\u628a\u641c\u5c0b\u6642\u9593\u770b\u7684\u5f88\u91cd\u8981\u7684set\uff0c\u7528hash\u65b9\u5f0f\u5be6\u4f5c\u7684set\uff0c\u6545access time  complexity = O(1)<\/p>\n<p><font color=\"red\">TreeSet =&gt;  <\/font>\u540c\u4e0a\uff0c\u4f46\u662f\u5b58\u5165\u7684\u5143\u7d20\u90fd\u6703\u7d93\u904e\u6392\u5217\uff0c\u6240\u4ee5\u901f\u5ea6\u6bd4HashSet \u6162\u4e00\u9ede<\/p>\n<p><font color=\"red\">LinkedHashSet  =&gt; <\/font><br \/>\nPerformance is likely to be just slightly below that of  HashSet, due to the added expense of maintaining the linked list, with one  exception: Iteration over a LinkedHashSet requires time proportional to the size  of the set, regardless of its capacity. Iteration over a HashSet is likely to be  more expensive, requiring time proportional to its capacity.<br \/>\n<font color=\"red\"><br \/>\nBitSet =&gt; <\/font>\u80fd\u5920\u9ad8\u6548\u7387\u7684\u5132\u5b58\u5927\u91cf [ 1 \/ 0 ] (\u958b\/\u95dc) \u8cc7\u6599<br \/>\n========================<br \/>\n<font color=\"red\">HashMap =&gt;<\/font>  \u7528\u4f86\u53d6\u4ee3HashTable\uff0c\u5132\u5b58 (key\/value) pairs<br \/>\n<font color=\"red\">TreeMap =&gt;<\/font> \u5132\u5b58  (key\/value) pairs\uff0c\u6703\u81ea\u52d5\u6839\u64daKey\u503c\u6392\u5e8f<\/p>\n<p><font color=\"red\">LinkedHashMap =&gt;  <\/font><br \/>\nPerformance is likely to be just slightly below that of HashMap, due  to the added expense of maintaining the linked list, with one exception:  Iteration over the collection-views of a LinkedHashMap requires time  proportional to the size of the map, regardless of its capacity. Iteration over  a HashMap is likely to be more expensive, requiring time proportional to its  capacity.<\/p>\n<p><font color=\"red\">IdentityHashMap =&gt;<\/font><br \/>\nThis has  better locality for large tables than does using separate arrays.) For many JRE  implementations and operation mixes, this class will yield better performance  than HashMap (which uses chaining rather than linear-probing<\/p>\n<p><font color=\"red\">WeakHashMap =&gt;<\/font>  \u9019\u500bmap\u4e2d\uff0c\u7531\u65bc\u6bcf\u500bValue\u50c5\u5b58\u5728\u4e00\u500b\u5be6\u9ad4\uff0c\u56e0\u800c\u7bc0\u7701\u4e86\u5132\u5b58\u7a7a\u9593\uff0c\u4e00\u4f46\u7a0b\u5f0f\u9700\u8981\u67d0\u500bValue\uff0c\u4fbf\u5728map\u4e2d\u641c\u5c0b\u65e2\u6709\u7684\u7269\u4ef6\uff0c\u4e26\u4f7f\u7528\u627e\u5230\u7684\u90a3\u500b\u7269\u4ef6\uff08\u800c\u975e\u91cd\u65b0\u518d\u9020\u4e00\u500b\uff09\uff0c\u7531\u65bc\u9019\u662f\u4e00\u7a2e\u7bc0\u7701\u5132\u5b58\u7a7a\u9593\u7684\u6280\u5de7\uff0c\u6240\u4ee5\u80fd\u5920\u65b9\u4fbf\u7684\u8b93GC\u81ea\u52d5\u6e05\u7406Key\u548cValue\uff0c\u4e00\u4f46Key\u4e0d\u5728\u88ab\u4f7f\u7528\uff0c\u4fbf\u6703\u89f8\u767c\u6e05\u7406\u52d5\u4f5c<\/p>\n<p>========================<br \/>\n<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u6587\u7ae0\u91cd\u65b0\u6574\u7406\u5404\u4f4d\u5927\u5927\u6240\u63d0\u4f9b\u7684\u8cc7\u6599 Collections =&gt; Collection\u662f\u6240\u6709List\u8ddf &hellip; <a href=\"https:\/\/jason695.why3s.tw\/wordpress\/2007\/05\/07\/%e5%90%84%e7%a8%ae-map-set-list\/\" class=\"more-link\">\u95b1\u8b80\u5168\u6587 <span class=\"screen-reader-text\">\u5404\u7a2e MAP SET LIST<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[21],"tags":[],"class_list":["post-302","post","type-post","status-publish","format-standard","hentry","category-java","no-featured-image"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts\/302","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/comments?post=302"}],"version-history":[{"count":0,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/posts\/302\/revisions"}],"wp:attachment":[{"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/media?parent=302"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/categories?post=302"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jason695.why3s.tw\/wordpress\/wp-json\/wp\/v2\/tags?post=302"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}