{"id":1327,"date":"2022-07-22T09:30:10","date_gmt":"2022-07-22T01:30:10","guid":{"rendered":"https:\/\/sanlangcode.com\/?p=1327"},"modified":"2022-07-22T09:30:10","modified_gmt":"2022-07-22T01:30:10","slug":"hashmap%e5%ba%95%e5%b1%82%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/sanlangcode.com\/index.php\/2022\/07\/22\/hashmap%e5%ba%95%e5%b1%82%e5%ae%9e%e7%8e%b0\/","title":{"rendered":"HashMap\u5e95\u5c42\u5b9e\u73b0\u548c\u6269\u5bb9\u673a\u5236"},"content":{"rendered":"\n<p>&nbsp;HashMap\u5e95\u5c42\u5b9e\u73b0\u91c7\u7528\u4e86\u54c8\u5e0c\u8868\uff0c\u8fd9\u662f\u4e00\u79cd\u975e\u5e38\u91cd\u8981\u7684\u6570\u636e\u7ed3\u6784\u3002\u5bf9\u4e8e\u6211\u4eec\u4ee5\u540e\u7406\u89e3\u5f88\u591a\u6280\u672f\u90fd\u975e\u5e38\u6709\u5e2e\u52a9(\u6bd4\u5982\uff1aredis\u6570\u636e\u5e93\u7684\u6838\u5fc3\u6280\u672f\u548cHashMap\u4e00\u6837)\uff0c\u56e0\u6b64\uff0c\u975e\u5e38\u6709\u5fc5\u8981\u8ba9\u5927\u5bb6\u7406\u89e3\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u6570\u636e\u7ed3\u6784\u4e2d\u7531\u6570\u7ec4\u548c\u94fe\u8868\u6765\u5b9e\u73b0\u5bf9\u6570\u636e\u7684\u5b58\u50a8\uff0c\u4ed6\u4eec\u5404\u6709\u7279\u70b9\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(1) \u6570\u7ec4\uff1a\u5360\u7528\u7a7a\u95f4\u8fde\u7eed\u3002 \u5bfb\u5740\u5bb9\u6613\uff0c\u67e5\u8be2\u901f\u5ea6\u5feb\u3002\u4f46\u662f\uff0c\u589e\u52a0\u548c\u5220\u9664\u6548\u7387\u975e\u5e38\u4f4e\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(2) \u94fe\u8868\uff1a\u5360\u7528\u7a7a\u95f4\u4e0d\u8fde\u7eed\u3002 \u5bfb\u5740\u56f0\u96be\uff0c\u67e5\u8be2\u901f\u5ea6\u6162\u3002\u4f46\u662f\uff0c\u589e\u52a0\u548c\u5220\u9664\u6548\u7387\u975e\u5e38\u9ad8\u3002<\/p>\n\n\n\n<p>\u00a0 \u00a0 \u00a0\u00a0\u90a3\u4e48\uff0c\u6211\u4eec\u80fd\u4e0d\u80fd\u7ed3\u5408\u6570\u7ec4\u548c\u94fe\u8868\u7684\u4f18\u70b9(\u5373\u67e5\u8be2\u5feb\uff0c\u589e\u5220\u6548\u7387\u4e5f\u9ad8)\u5462? \u7b54\u6848\u5c31\u662f\u201c\u54c8\u5e0c\u8868\u201d\u3002 \u54c8\u5e0c\u8868\u7684\u672c\u8d28\u5c31\u662f\u201c\u6570\u7ec4+\u94fe\u8868\u201d\u3002<\/p>\n\n\n\n<p><strong>\u25aa&nbsp;Hashmap\u57fa\u672c\u7ed3\u6784\u8bb2\u89e3<\/strong><\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u54c8\u5e0c\u8868\u7684\u57fa\u672c\u7ed3\u6784\u5c31\u662f\u201c\u6570\u7ec4+\u94fe\u8868\u201d\u3002\u6211\u4eec\u6253\u5f00HashMap\u6e90\u7801\uff0c\u53d1\u73b0\u6709\u5982\u4e0b\u4e24\u4e2a\u6838\u5fc3\u5185\u5bb9\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.sxt.cn\/360shop\/Public\/admin\/UEditor\/20170524\/1495618960152437.png\" alt=\"\u56fe9-12 HashMap\u5e95\u5c42\u6e90\u7801(1).png\" title=\"1495618960152437.png\"\/><\/figure>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u5176\u4e2d\u7684Entry[] table \u5c31\u662fHashMap\u7684\u6838\u5fc3\u6570\u7ec4\u7ed3\u6784\uff0c\u6211\u4eec\u4e5f\u79f0\u4e4b\u4e3a\u201c\u4f4d\u6876\u6570\u7ec4\u201d\u3002\u6211\u4eec\u518d\u7ee7\u7eed\u770bEntry\u662f\u4ec0\u4e48\uff0c\u6e90\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.sxt.cn\/360shop\/Public\/admin\/UEditor\/20170524\/1495619012687826.png\" alt=\"\u56fe9-13 HashMap\u5e95\u5c42\u6e90\u7801(2).png\" title=\"1495619012687826.png\"\/><\/figure>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u4e00\u4e2aEntry\u5bf9\u8c61\u5b58\u50a8\u4e86\uff1a<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;1. key\uff1a\u952e\u5bf9\u8c61 value\uff1a\u503c\u5bf9\u8c61<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;2. next:\u4e0b\u4e00\u4e2a\u8282\u70b9<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;3. hash: \u952e\u5bf9\u8c61\u7684hash\u503c<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u663e\u7136\u6bcf\u4e00\u4e2aEntry\u5bf9\u8c61\u5c31\u662f\u4e00\u4e2a\u5355\u5411\u94fe\u8868\u7ed3\u6784\uff0c\u6211\u4eec\u4f7f\u7528\u56fe\u5f62\u8868\u793a\u4e00\u4e2aEntry\u5bf9\u8c61\u7684\u5178\u578b\u793a\u610f\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.sxt.cn\/360shop\/Public\/admin\/UEditor\/20170524\/1495619082593896.png\" alt=\"\u56fe9-14 Entry\u5bf9\u8c61\u5b58\u50a8\u7ed3\u6784\u56fe.png\" title=\"1495619082593896.png\"\/><\/figure>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u7136\u540e\uff0c\u6211\u4eec\u753b\u51faEntry[]\u6570\u7ec4\u7684\u7ed3\u6784(\u8fd9\u4e5f\u662fHashMap\u7684\u7ed3\u6784)\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.sxt.cn\/360shop\/Public\/admin\/UEditor\/20170524\/1495619119905721.png\" alt=\"\u56fe9-15 Entry\u6570\u7ec4\u5b58\u50a8\u7ed3\u6784\u56fe.png\" title=\"1495619119905721.png\"\/><\/figure>\n\n\n\n<p><strong>\u25aa \u5b58\u50a8\u6570\u636e\u8fc7\u7a0bput(key,value)<\/strong><\/p>\n\n\n\n<p>\u00a0 \u00a0 \u00a0 \u660e\u767d\u4e86HashMap\u7684\u57fa\u672c\u7ed3\u6784\u540e\uff0c\u6211\u4eec\u7ee7\u7eed\u6df1\u5165\u5b66\u4e60HashMap\u5982\u4f55\u5b58\u50a8\u6570\u636e\u3002\u6b64\u5904\u7684\u6838\u5fc3\u662f\u5982\u4f55\u4ea7\u751fhash\u503c\uff0c\u8be5\u503c\u7528\u6765\u5bf9\u5e94\u6570\u7ec4\u7684\u5b58\u50a8\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.sxt.cn\/360shop\/Public\/admin\/UEditor\/20170524\/1495619181777762.png\" alt=\"\u56fe9-16 HashMap\u5b58\u50a8\u6570\u636e\u8fc7\u7a0b\u793a\u610f\u56fe.png\"\/><\/figure>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u6211\u4eec\u7684\u76ee\u7684\u662f\u5c06\u201dkey-value\u4e24\u4e2a\u5bf9\u8c61\u201d\u6210\u5bf9\u5b58\u653e\u5230HashMap\u7684Entry[]\u6570\u7ec4\u4e2d\u3002\u53c2\u89c1\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(1) \u83b7\u5f97key\u5bf9\u8c61\u7684hashcode<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u9996\u5148\u8c03\u7528key\u5bf9\u8c61\u7684hashcode()\u65b9\u6cd5\uff0c\u83b7\u5f97hashcode\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(2) \u6839\u636ehashcode\u8ba1\u7b97\u51fahash\u503c(\u8981\u6c42\u5728[0, \u6570\u7ec4\u957f\u5ea6-1]\u533a\u95f4)<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hashcode\u662f\u4e00\u4e2a\u6574\u6570\uff0c\u6211\u4eec\u9700\u8981\u5c06\u5b83\u8f6c\u5316\u6210[0, \u6570\u7ec4\u957f\u5ea6-1]\u7684\u8303\u56f4\u3002\u6211\u4eec\u8981\u6c42\u8f6c\u5316\u540e\u7684hash\u503c\u5c3d\u91cf\u5747\u5300\u5730\u5206\u5e03\u5728[0,\u6570\u7ec4\u957f\u5ea6-1]\u8fd9\u4e2a\u533a\u95f4\uff0c\u51cf\u5c11\u201chash\u51b2\u7a81\u201d<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;i. \u4e00\u79cd\u6781\u7aef\u7b80\u5355\u548c\u4f4e\u4e0b\u7684\u7b97\u6cd5\u662f\uff1a<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hash\u503c = hashcode\/hashcode;<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;\u4e5f\u5c31\u662f\u8bf4\uff0chash\u503c\u603b\u662f1\u3002\u610f\u5473\u7740\uff0c\u952e\u503c\u5bf9\u5bf9\u8c61\u90fd\u4f1a\u5b58\u50a8\u5230\u6570\u7ec4\u7d22\u5f151\u4f4d\u7f6e\uff0c\u8fd9\u6837\u5c31\u5f62\u6210\u4e00\u4e2a\u975e\u5e38\u957f\u7684\u94fe\u8868\u3002\u76f8\u5f53\u4e8e\u6bcf\u5b58\u50a8\u4e00\u4e2a\u5bf9\u8c61\u90fd\u4f1a\u53d1\u751f\u201chash\u51b2\u7a81\u201d\uff0cHashMap\u4e5f\u9000\u5316\u6210\u4e86\u4e00\u4e2a\u201c\u94fe\u8868\u201d\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;ii. \u4e00\u79cd\u7b80\u5355\u548c\u5e38\u7528\u7684\u7b97\u6cd5\u662f(\u76f8\u9664\u53d6\u4f59\u7b97\u6cd5)\uff1a<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;hash\u503c = hashcode%\u6570\u7ec4\u957f\u5ea6<\/p>\n\n\n\n<p>\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u8fd9\u79cd\u7b97\u6cd5\u53ef\u4ee5\u8ba9hash\u503c\u5747\u5300\u7684\u5206\u5e03\u5728[0,\u6570\u7ec4\u957f\u5ea6-1]\u7684\u533a\u95f4\u3002 \u65e9\u671f\u7684HashTable\u5c31\u662f\u91c7\u7528\u8fd9\u79cd\u7b97\u6cd5\u3002\u4f46\u662f\uff0c\u8fd9\u79cd\u7b97\u6cd5\u7531\u4e8e\u4f7f\u7528\u4e86\u201c\u9664\u6cd5\u201d\uff0c\u6548\u7387\u4f4e\u4e0b\u3002JDK\u540e\u6765\u6539\u8fdb\u4e86\u7b97\u6cd5\u3002\u9996\u5148\u7ea6\u5b9a\u6570\u7ec4\u957f\u5ea6\u5fc5\u987b\u4e3a2\u7684\u6574\u6570\u5e42\uff0c\u8fd9\u6837\u91c7\u7528\u4f4d\u8fd0\u7b97\u5373\u53ef\u5b9e\u73b0\u53d6\u4f59\u7684\u6548\u679c\uff1ahash\u503c = hashcode&amp;(\u6570\u7ec4\u957f\u5ea6-1)\u3002<\/p>\n\n\n\n<p>&nbsp;\u8fd0\u884c\u5982\u4e0a\u7a0b\u5e8f\uff0c\u6211\u4eec\u5c31\u80fd\u53d1\u73b0\u76f4\u63a5\u53d6\u4f59(h%length)\u548c\u4f4d\u8fd0\u7b97(h&amp;(length-1))\u7ed3\u679c\u662f\u4e00\u81f4\u7684\u3002\u4e8b\u5b9e\u4e0a\uff0c\u4e3a\u4e86\u83b7\u5f97\u66f4\u597d\u7684\u6563\u5217\u6548\u679c\uff0cJDK\u5bf9hashcode\u8fdb\u884c\u4e86\u4e24\u6b21\u6563\u5217\u5904\u7406(\u6838\u5fc3\u76ee\u6807\u5c31\u662f\u4e3a\u4e86\u5206\u5e03\u66f4\u6563\u66f4\u5747\u5300)\uff0c\u6e90\u7801\u5982\u4e0b\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/www.sxt.cn\/360shop\/Public\/admin\/UEditor\/20170524\/1495619395858263.png\" alt=\"\u56fe9-17 hash\u7b97\u6cd5\u6e90\u7801.png\" title=\"1495619395858263.png\"\/><\/figure>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(3) \u751f\u6210Entry\u5bf9\u8c61<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;\u5982\u4e0a\u6240\u8ff0\uff0c\u4e00\u4e2aEntry\u5bf9\u8c61\u5305\u542b4\u90e8\u5206\uff1akey\u5bf9\u8c61\u3001value\u5bf9\u8c61\u3001hash\u503c\u3001\u6307\u5411\u4e0b\u4e00\u4e2aEntry\u5bf9\u8c61\u7684\u5f15\u7528\u3002\u6211\u4eec\u73b0\u5728\u7b97\u51fa\u4e86hash\u503c\u3002\u4e0b\u4e00\u4e2aEntry\u5bf9\u8c61\u7684\u5f15\u7528\u4e3anull\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(4) \u5c06Entry\u5bf9\u8c61\u653e\u5230table\u6570\u7ec4\u4e2d<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;\u5982\u679c\u672cEntry\u5bf9\u8c61\u5bf9\u5e94\u7684\u6570\u7ec4\u7d22\u5f15\u4f4d\u7f6e\u8fd8\u6ca1\u6709\u653eEntry\u5bf9\u8c61\uff0c\u5219\u76f4\u63a5\u5c06Entry\u5bf9\u8c61\u5b58\u50a8\u8fdb\u6570\u7ec4;\u5982\u679c\u5bf9\u5e94\u7d22\u5f15\u4f4d\u7f6e\u5df2\u7ecf\u6709Entry\u5bf9\u8c61\uff0c\u5219\u5c06\u5df2\u6709Entry\u5bf9\u8c61\u7684next\u6307\u5411\u672cEntry\u5bf9\u8c61\uff0c\u5f62\u6210\u94fe\u8868\u3002<\/p>\n\n\n\n<p><strong>\u603b\u7ed3\u5982\u4e0a\u8fc7\u7a0b\uff1a<\/strong><\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u5f53\u6dfb\u52a0\u4e00\u4e2a\u5143\u7d20(key-value)\u65f6\uff0c\u9996\u5148\u8ba1\u7b97key\u7684hash\u503c\uff0c\u4ee5\u6b64\u786e\u5b9a\u63d2\u5165\u6570\u7ec4\u4e2d\u7684\u4f4d\u7f6e\uff0c\u4f46\u662f\u53ef\u80fd\u5b58\u5728\u540c\u4e00hash\u503c\u7684\u5143\u7d20\u5df2\u7ecf\u88ab\u653e\u5728\u6570\u7ec4\u540c\u4e00\u4f4d\u7f6e\u4e86\uff0c\u8fd9\u65f6\u5c31\u6dfb\u52a0\u5230\u540c\u4e00hash\u503c\u7684\u5143\u7d20\u7684\u540e\u9762\uff0c\u4ed6\u4eec\u5728\u6570\u7ec4\u7684\u540c\u4e00\u4f4d\u7f6e\uff0c\u5c31\u5f62\u6210\u4e86\u94fe\u8868\uff0c\u540c\u4e00\u4e2a\u94fe\u8868\u4e0a\u7684Hash\u503c\u662f\u76f8\u540c\u7684\uff0c\u6240\u4ee5\u8bf4\u6570\u7ec4\u5b58\u653e\u7684\u662f\u94fe\u8868\u3002 JDK8\u4e2d\uff0c\u5f53\u94fe\u8868\u957f\u5ea6\u5927\u4e8e8\u65f6\uff0c\u94fe\u8868\u5c31\u8f6c\u6362\u4e3a\u7ea2\u9ed1\u6811\uff0c\u8fd9\u6837\u53c8\u5927\u5927\u63d0\u9ad8\u4e86\u67e5\u627e\u7684\u6548\u7387\u3002<\/p>\n\n\n\n<p><strong>\u25aa \u53d6\u6570\u636e\u8fc7\u7a0bget(key)<\/strong><\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; \u6211\u4eec\u9700\u8981\u901a\u8fc7key\u5bf9\u8c61\u83b7\u5f97\u201c\u952e\u503c\u5bf9\u201d\u5bf9\u8c61\uff0c\u8fdb\u800c\u8fd4\u56devalue\u5bf9\u8c61\u3002\u660e\u767d\u4e86\u5b58\u50a8\u6570\u636e\u8fc7\u7a0b\uff0c\u53d6\u6570\u636e\u5c31\u6bd4\u8f83\u7b80\u5355\u4e86\uff0c\u53c2\u89c1\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(1) \u83b7\u5f97key\u7684hashcode\uff0c\u901a\u8fc7hash()\u6563\u5217\u7b97\u6cd5\u5f97\u5230hash\u503c\uff0c\u8fdb\u800c\u5b9a\u4f4d\u5230\u6570\u7ec4\u7684\u4f4d\u7f6e\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(2) \u5728\u94fe\u8868\u4e0a\u6328\u4e2a\u6bd4\u8f83key\u5bf9\u8c61\u3002 \u8c03\u7528equals()\u65b9\u6cd5\uff0c\u5c06key\u5bf9\u8c61\u548c\u94fe\u8868\u4e0a\u6240\u6709\u8282\u70b9\u7684key\u5bf9\u8c61\u8fdb\u884c\u6bd4\u8f83\uff0c\u76f4\u5230\u78b0\u5230\u8fd4\u56detrue\u7684\u8282\u70b9\u5bf9\u8c61\u4e3a\u6b62\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;(3) \u8fd4\u56deequals()\u4e3atrue\u7684\u8282\u70b9\u5bf9\u8c61\u7684value\u5bf9\u8c61\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u660e\u767d\u4e86\u5b58\u53d6\u6570\u636e\u7684\u8fc7\u7a0b\uff0c\u6211\u4eec\u518d\u6765\u770b\u4e00\u4e0bhashcode()\u548cequals\u65b9\u6cd5\u7684\u5173\u7cfb\uff1a<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;Java\u4e2d\u89c4\u5b9a\uff0c\u4e24\u4e2a\u5185\u5bb9\u76f8\u540c(equals()\u4e3atrue)\u7684\u5bf9\u8c61\u5fc5\u987b\u5177\u6709\u76f8\u7b49\u7684hashCode\u3002\u56e0\u4e3a\u5982\u679cequals()\u4e3atrue\u800c\u4e24\u4e2a\u5bf9\u8c61\u7684hashcode\u4e0d\u540c;\u90a3\u5728\u6574\u4e2a\u5b58\u50a8\u8fc7\u7a0b\u4e2d\u5c31\u53d1\u751f\u4e86\u6096\u8bba\u3002<\/p>\n\n\n\n<p><strong>\u25aa \u6269\u5bb9\u95ee\u9898<\/strong><\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; HashMap\u7684\u4f4d\u6876\u6570\u7ec4\uff0c\u521d\u59cb\u5927\u5c0f\u4e3a16\u3002\u5b9e\u9645\u4f7f\u7528\u65f6\uff0c\u663e\u7136\u5927\u5c0f\u662f\u53ef\u53d8\u7684\u3002\u5982\u679c\u4f4d\u6876\u6570\u7ec4\u4e2d\u7684\u5143\u7d20\u8fbe\u5230(0.75*\u6570\u7ec4 length)\uff0c \u5c31\u91cd\u65b0\u8c03\u6574\u6570\u7ec4\u5927\u5c0f\u53d8\u4e3a\u539f\u67652\u500d\u5927\u5c0f\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u6269\u5bb9\u5f88\u8017\u65f6\u3002\u6269\u5bb9\u7684\u672c\u8d28\u662f\u5b9a\u4e49\u65b0\u7684\u66f4\u5927\u7684\u6570\u7ec4\uff0c\u5e76\u5c06\u65e7\u6570\u7ec4\u5185\u5bb9\u6328\u4e2a\u62f7\u8d1d\u5230\u65b0\u6570\u7ec4\u4e2d\u3002<\/p>\n\n\n\n<p><strong>\u25aa&nbsp;JDK8\u5c06\u94fe\u8868\u5728\u5927\u4e8e8\u60c5\u51b5\u4e0b\u53d8\u4e3a\u7ea2\u9ed1\u4e8c\u53c9\u6811<\/strong><\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp; JDK8\u4e2d\uff0cHashMap\u5728\u5b58\u50a8\u4e00\u4e2a\u5143\u7d20\u65f6\uff0c\u5f53\u5bf9\u5e94\u94fe\u8868\u957f\u5ea6\u5927\u4e8e8\u65f6\uff0c\u94fe\u8868\u5c31\u8f6c\u6362\u4e3a\u7ea2\u9ed1\u6811\uff0c\u8fd9\u6837\u53c8\u5927\u5927\u63d0\u9ad8\u4e86\u67e5\u627e\u7684\u6548\u7387\u3002<\/p>\n\n\n\n<p>&nbsp; &nbsp; &nbsp;&nbsp;\u4e0b\u4e00\u8282\uff0c\u6211\u4eec\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e2a\u4e8c\u53c9\u6811\u3002\u540c\u65f6\uff0c\u4e5f\u4fbf\u4e8e\u5927\u5bb6\u7406\u89e3TreeMap\u7684\u5e95\u5c42\u7ed3\u6784\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;HashMap\u5e95\u5c42\u5b9e&#46;&#46;&#46;<\/p>\n","protected":false},"author":1,"featured_media":1328,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-1327","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-4"],"_links":{"self":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/1327","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/comments?post=1327"}],"version-history":[{"count":0,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/posts\/1327\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=1327"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=1327"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sanlangcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=1327"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}