{"id":195,"date":"2015-04-12T19:56:52","date_gmt":"2015-04-12T11:56:52","guid":{"rendered":"https:\/\/ai.zhousir.top\/?p=195"},"modified":"2026-08-18T12:09:28","modified_gmt":"2026-08-18T04:09:28","slug":"java%e5%8f%8c%e5%90%91%e9%93%be%e8%a1%a8%e7%9a%84%e5%ae%9e%e7%8e%b0","status":"publish","type":"post","link":"https:\/\/ai.zhousir.top\/?p=195","title":{"rendered":"Java\u53cc\u5411\u94fe\u8868\u7684\u5b9e\u73b0"},"content":{"rendered":"<section id=\"wenyan\" style=\"font-family: system-ui, 'Apple Color Emoji', 'Segoe UI', 'Segoe UI Symbol', 'Noto Sans', Roboto, sans-serif; line-height: 1.75; font-size: 16px; color: #000000; caret-color: #000000;\" data-provider=\"WenYan\">\n<p style=\"margin: 1em 0px;\">\u5b66\u8fc7\u6570\u636e\u7ed3\u6784\u7684\u4eba\u5bf9\u53cc\u5411\u94fe\u8868\u90fd\u4e0d\u964c\u751f\u3002\u7528 Java \u600e\u4e48\u5b9e\u73b0\uff1f\u94fe\u8868\u5728\u5185\u5b58\u91cc\u5e76\u4e0d\u8fde\u7eed\uff0c\u903b\u8f91\u987a\u5e8f\u9760\u6307\u9488\u4e32\u8d77\u6765\u3002\u6bcf\u4e2a\u7ed3\u70b9\u6709\u6570\u636e\u57df\uff0c\u8fd8\u6709\u6307\u5411\u5176\u5b83\u7ed3\u70b9\u7684\u5f15\u7528\u3002<\/p>\n<p style=\"margin: 1em 0px;\">\u5355\u94fe\u8868\u53ea\u6709\u540e\u7ee7\u3002\u8981\u5bf9\u67d0\u4e2a\u7ed3\u70b9\u7684\u524d\u9a71\u52a8\u624b\uff0c\u53ea\u80fd\u4ece\u5934\u518d\u8d70\u4e00\u904d\uff0c\u5f88\u9ebb\u70e6\u3002\u53cc\u5411\u94fe\u8868\u591a\u4e00\u4e2a\u6307\u5411\u7236\u7ed3\u70b9\u7684\u5f15\u7528\uff0c\u524d\u540e\u90fd\u80fd\u8d70\u3002<\/p>\n<p><!--more--><\/p>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e00\u3001\u7ed3\u70b9\uff1a\u6570\u636e + \u7236\u6307\u9488 + \u5b50\u6307\u9488<\/h2>\n<p style=\"margin: 1em 0px;\">\u81ea\u5b9a\u4e49\u7ed3\u70b9 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">LinkNode<\/code>\uff1a\u4e00\u4e2a\u6570\u636e\u57df <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">obj<\/code>\uff0c\u4e24\u4e2a\u6307\u9488\u57df <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">child<\/code>\uff08\u540e\u7ee7\uff09\u548c <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">parent<\/code>\uff08\u524d\u9a71\uff09\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package cn.\u94fe\u8868;\n\n\/**\n\n * \u53cc\u5411\u94fe\u8868\n\n * \n\n * \n\n *\/\n\npublic class LinkNode {\n\n\tprivate Object obj;\n\n\tprivate LinkNode child;\n\n\tprivate LinkNode parent;\n\n\n\n\tpublic LinkNode(Object obj) {\n\n\t\tthis.obj = obj;\n\n\t}\n\n\n\n\t\/\/ \u5b9a\u4e49\u65b9\u6cd5\n\n\tpublic Object getObj() {\n\n\t\treturn obj;\n\n\t}\n\n\n\n\tpublic void setObj(Object obj) {\n\n\t\tthis.obj = obj;\n\n\t}\n\n\n\n\tpublic LinkNode getChild() {\n\n\t\treturn child;\n\n\t}\n\n\n\n\tpublic void setChild(LinkNode child) {\n\n\t\tthis.child = child;\n\n\t}\n\n\n\n\tpublic LinkNode getParent() {\n\n\t\treturn parent;\n\n\t}\n\n\n\n\tpublic void setParent(LinkNode parent) {\n\n\t\tthis.parent = parent;\n\n\t}\n\n}<\/code><\/pre>\n<h2 style=\"padding: 1px 12.5px; color: #ffffff; margin: 1.2em 0px 1em; border-radius: 4px; display: inline-block; background-color: #4870ac; font-size: 1.3em;\">\u4e8c\u3001\u94fe\u8868\u64cd\u4f5c\uff1a\u589e\u5220\u6539\u67e5\u4e0e\u53cc\u5411\u904d\u5386<\/h2>\n<p style=\"margin: 1em 0px;\">\u6d4b\u8bd5\u7c7b <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">LinkListTest<\/code> \u7ef4\u62a4\u5934\u7ed3\u70b9 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">front<\/code> \u548c\u5c3e\u7ed3\u70b9 <code style=\"font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; color: #4870ac; font-size: 0.9em; font-weight: normal; overflow-wrap: break-word; padding: 2px 4px; border-radius: 3px; margin: 2px; background-color: #f6f8fa; word-break: break-all;\">last<\/code>\u3002\u63d0\u4f9b\uff1a\u5c3e\u63d2\u3001\u6309\u4f4d\u7f6e\u63d2\u3001\u6309\u4f4d\u7f6e\u5220\u3001\u6309\u4f4d\u7f6e\u53d6\u3001\u66f4\u65b0\u3001\u6c42\u957f\u5ea6\u3001\u4ece\u5934\u6253\u5370\u3001\u4ece\u67d0\u4e0b\u6807\u5411\u524d\u518d\u5411\u540e\u6253\u5370\u3002<\/p>\n<pre style=\"overflow: auto hidden; word-break: normal; white-space: pre; tab-size: 2; border-radius: 5px; line-height: 2; margin: 1em 0.5em; padding: 0.5em; box-shadow: rgba(0, 0, 0, 0.55) 0px 1px 5px; font-size: 12px; background: #002b36; max-width: 100%; overflow-wrap: normal;\"><code class=\"hljs\" style=\"word-break: normal; white-space: nowrap; tab-size: 2; font-size: 12px; font-family: Menlo, Monaco, Consolas, 'Liberation Mono', 'Roboto Mono', 'Courier New', 'Microsoft YaHei', monospace; display: block; overflow-x: auto; margin: 0.5em; padding: 3px 5px; color: #93a1a1; background: #002b36; overflow-wrap: normal;\">package cn.\u94fe\u8868;\n\n\/**\n\n * \u53cc\u5411\u94fe\u8868\u7684\u6d4b\u8bd5\n\n * \n\n * @author Administrator\n\n * \n\n *\/\n\npublic class LinkListTest {\n\n\tprivate static LinkNode front = null;\n\n\tprivate LinkNode last = front;\n\n\n\n\tpublic static void main(String args[]) {\n\n\t\tLinkListTest list = new LinkListTest();\n\n\t\tlist.add(\"\u5934\u7ed3\u70b9\");\n\n\t\tfor (int i = 0; i &lt; 10; i++) {\n\n\t\t\tlist.add(\"\u7ed3\u70b9\" + i);\n\n\t\t}\n\n\t\t\/\/ \u6d4b\u8bd5\u6307\u5b9a\u4f4d\u7f6e\u4e0b\u53d6\u5f97\u7ed3\u70b9\n\n\t\tObject obj = list.getLinkNode(3).getObj();\n\n\t\t\/\/ \u6d4b\u8bd5\u5728\u6307\u5b9a\u4f4d\u7f6e\u63d2\u5165\u5143\u7d20\n\n\t\tlist.add(3, \"\u65b0\u6765\u7684\u5143\u7d20\");\n\n\t\tSystem.out.println(\"&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;\" + obj);\n\n\t\tlist.printLinkNode(front);\n\n\t\tSystem.out.println(\"&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;\");\n\n\t\t\/\/ list.remove(3);\n\n\t\t\/\/ list.printLinkNode(front);\n\n\t\tlist.upDate(3, \"\u503c\u88ab\u6539\u53d8\u7684\u5143\u7d20\");\n\n\t\tlist.printLinkNode(front);\n\n\t\tSystem.out.println(\"&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;&gt;&lt;\");\n\n\t\tlist.printLinkNode1(3);\n\n\n\n\t}\n\n\n\n\t\/**\n\n\t * \u5728\u94fe\u8868\u7684\u540e\u9762\u63d2\u5165\u5143\u7d20\n\n\t * \n\n\t * @param obj\n\n\t *\/\n\n\tpublic void add(Object obj) {\n\n\t\t\/\/ \u6839\u636e\u7ed9\u5b9a\u7684\u503c\u521b\u5efa\u7ed3\u70b9\n\n\t\tLinkNode node = new LinkNode(obj);\n\n\t\tif (front == null) {\n\n\t\t\t\/\/ \u5982\u679c\u94fe\u8868\u4e3a\u7a7a\u7684\u65f6\u5019\n\n\t\t\t\/\/ front.setChild(node);\n\n\t\t\t\/\/ node.setParent(front);\n\n\t\t\t\/\/ \u7b2c\u4e00\u4e2a\u7ed3\u70b9\u4e5f\u5373\u662f\u6700\u540e\u4e00\u4e2a\u7ed3\u70b9\n\n\t\t\tfront = node;\n\n\t\t\tlast = front;\n\n\t\t\t\/\/ System.out.println(front.getObj());\n\n\t\t} else {\n\n\t\t\t\/\/ \u65b0\u63d2\u5165\u7684\u7ed3\u70b9\u4e3a\u6700\u540e\u4e00\u4e2a\u7ed3\u70b9\n\n\t\t\tlast.setChild(node);\n\n\t\t\tnode.setParent(last);\n\n\t\t\tlast = node;\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u5728\u6307\u5b9a\u4f4d\u7f6e\u63d2\u5165\u5143\u7d20\n\n\t * \n\n\t * @param index\n\n\t * @param obj\n\n\t *\/\n\n\tpublic void add(int index, Object obj) {\n\n\t\t\/\/ \u5148\u521b\u5efa\u7ed3\u70b9\n\n\t\tLinkNode node = new LinkNode(obj);\n\n\t\t\/\/ \u5224\u65ad\u4f20\u5165\u7684\u4e0b\u6807\n\n\t\tif (index &lt; 0 || index &gt; size()) {\n\n\t\t\tthrow new RuntimeException(\"\u4e0b\u6807\u8d8a\u754c\uff1asize\uff1a\" + size() + \"index\uff1a\" + index);\n\n\t\t} else {\n\n\t\t\t\/\/ \u4f20\u5165\u7684\u4e0b\u6807\u7b26\u5408\u8981\u6c42\n\n\t\t\tif (front == null) {\n\n\t\t\t\t\/\/ \u5982\u679c\u94fe\u8868\u4e3a\u7a7a\u7684\u65f6\u5019\n\n\t\t\t\tfront = node;\n\n\t\t\t\tlast = front;\n\n\t\t\t} else if (index == size()) {\n\n\t\t\t\tadd(node);\n\n\t\t\t} else {\n\n\t\t\t\t\/\/ \u94fe\u8868\u4e0d\u4e3a\u7a7a,\u53d6\u5f97\u5f53\u524d\u4e0b\u6807\u7684\u7ed3\u70b9\n\n\t\t\t\tLinkNode nownode = getLinkNode(index);\n\n\t\t\t\t\/\/ \u5f97\u5230\u7236\u7ed3\u70b9\n\n\t\t\t\tLinkNode fnode = nownode.getParent();\n\n\t\t\t\t\/\/ \u91cd\u65b0\u5b9a\u4e49\u65b0\u7684\u5f15\u7528\u5173\u7cfb\n\n\t\t\t\tfnode.setChild(node);\n\n\t\t\t\tnode.setParent(fnode);\n\n\n\n\t\t\t\tnode.setChild(nownode);\n\n\t\t\t\tnownode.setParent(node);\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u6839\u636e\u4e0b\u6807\uff0c\u5220\u9664\u5f53\u524d\u7684\u7ed3\u70b9\n\n\t * \n\n\t * @param index\n\n\t *\/\n\n\tpublic void remove(int index) {\n\n\t\tif (index &lt; 0 || index &gt; size()) {\n\n\t\t\tthrow new RuntimeException(\"\u4e0b\u6807\u8d8a\u754c\uff1asize\uff1a\" + size() + \"index\uff1a\" + index);\n\n\t\t} else {\n\n\t\t\t\/\/ \u4f20\u5165\u7684\u4e0b\u6807\u7b26\u5408\u8981\u6c42\n\n\t\t\tif (front == null) {\n\n\t\t\t\t\/\/ \u5982\u679c\u94fe\u8868\u4e3a\u7a7a\u7684\u65f6\u5019\n\n\t\t\t\tSystem.out.println(\"\u94fe\u8868\u4e3a\u7a7a\uff0c\u4e0d\u80fd\u5220\u9664\u5143\u7d20\u5566\uff01\uff01\uff01\");\n\n\t\t\t} else {\n\n\t\t\t\t\/\/ \u94fe\u8868\u4e0d\u4e3a\u7a7a,\u53d6\u5f97\u5f53\u524d\u4e0b\u6807\u7684\u7ed3\u70b9\n\n\t\t\t\tLinkNode nownode = getLinkNode(index);\n\n\t\t\t\t\/\/ \u5f97\u5230\u7236\u7ed3\u70b9\n\n\t\t\t\tLinkNode fnode = nownode.getParent();\n\n\t\t\t\t\/\/ \u5f97\u5230\u7236\u7ed3\u70b9\n\n\t\t\t\tLinkNode cnode = nownode.getChild();\n\n\t\t\t\t\/\/ \u91cd\u65b0\u5b9a\u4e49\u65b0\u7684\u5f15\u7528\u5173\u7cfb\n\n\t\t\t\tfnode.setChild(cnode);\n\n\t\t\t\tcnode.setParent(fnode);\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u6839\u636e\u4e0b\u6807\u53d6\u5f97\u5f53\u524d\u7684\u7ed3\u70b9\n\n\t * \n\n\t * @param index\n\n\t *            \u4e0b\u6807\u503c\n\n\t * @return\n\n\t *\/\n\n\tpublic LinkNode getLinkNode(int index) {\n\n\t\t\/\/ \u5224\u65ad\u4f20\u5165\u7684\u4e0b\u6807\n\n\t\tif (index &lt; 0 || index &gt; size()) {\n\n\t\t\tthrow new RuntimeException(\"\u4e0b\u6807\u8d8a\u754c\uff1asize\uff1a\" + size() + \"index\uff1a\" + index);\n\n\t\t} else {\n\n\t\t\t\/\/ \u5148\u53d6\u5f97\u5934\u7ed3\u70b9\n\n\t\t\tLinkNode node = front;\n\n\t\t\tint i = 0;\n\n\t\t\twhile (i &lt; index) {\n\n\t\t\t\ti++;\n\n\t\t\t\tnode = node.getChild();\n\n\t\t\t}\n\n\t\t\treturn node;\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u5728\u6307\u5b9a\u7684\u4f4d\u7f6e\uff0c\u66f4\u65b0\u8be5\u7ed3\u70b9\uff0c\u7ed3\u70b9\u7684\u503c\u4e3aobj\n\n\t * \n\n\t * @param index\n\n\t * @param obj\n\n\t *            \u66f4\u6539\u7684\u7ed3\u70b9\u7684\u503c\n\n\t *\/\n\n\tpublic void upDate(int index, Object obj) {\n\n\t\tif (index &lt; 0 || index &gt; size()) {\n\n\t\t\tthrow new RuntimeException(\"\u4e0b\u6807\u8d8a\u754c\uff1asize\uff1a\" + size() + \"index\uff1a\" + index);\n\n\t\t} else {\n\n\t\t\t\/\/ \u4f20\u5165\u7684\u4e0b\u6807\u7b26\u5408\u8981\u6c42\n\n\t\t\tif (front == null) {\n\n\t\t\t\t\/\/ \u5982\u679c\u94fe\u8868\u4e3a\u7a7a\u7684\u65f6\u5019\n\n\t\t\t\tSystem.out.println(\"\u94fe\u8868\u4e3a\u7a7a\uff0c\u4e0d\u80fd\u66f4\u65b0\u5143\u7d20\u5566\uff01\uff01\uff01\");\n\n\t\t\t} else {\n\n\t\t\t\t\/\/ \u94fe\u8868\u4e0d\u4e3a\u7a7a,\u53d6\u5f97\u5f53\u524d\u4e0b\u6807\u7684\u7ed3\u70b9\n\n\t\t\t\tLinkNode nownode = getLinkNode(index);\n\n\t\t\t\t\/\/ \u7ed9\u7ed3\u70b9\u91cd\u65b0\u8d4b\u503c\n\n\t\t\t\tnownode.setObj(obj);\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u5f97\u5230\u94fe\u8868\u7684\u957f\u5ea6\n\n\t * \n\n\t * @return\n\n\t *\/\n\n\tpublic int size() {\n\n\t\tif (front == null) {\n\n\t\t\t\/\/ \u94fe\u8868\u4e3a\u7a7a\n\n\t\t\treturn 0;\n\n\t\t} else {\n\n\t\t\t\/\/ \u4e0d\u4e3a\u7a7a\n\n\t\t\tLinkNode node = front;\n\n\t\t\tint count = 0;\n\n\t\t\twhile (node != null) {\n\n\t\t\t\tcount++;\n\n\t\t\t\tnode = node.getChild();\n\n\t\t\t}\n\n\t\t\treturn count;\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u6253\u5370\u94fe\u8868\n\n\t * \n\n\t * @param node\n\n\t *            \u4f20\u5165\u94fe\u8868\u7684\u5934\u7ed3\u70b9\n\n\t *\/\n\n\tpublic void printLinkNode(LinkNode node) {\n\n\t\tif (front == null) {\n\n\t\t\tSystem.out.println(\"\u6b64\u94fe\u8868\u4e3a\u7a7a\uff01\uff01\uff01\");\n\n\t\t} else {\n\n\t\t\t\/\/ \u5148\u53d6\u5f97\u5934\u7ed3\u70b9\n\n\t\t\tLinkNode n = front;\n\n\t\t\t\/\/ \u904d\u5386\u94fe\u8868\n\n\t\t\twhile (n != null) {\n\n\t\t\t\tObject obj = n.getObj();\n\n\t\t\t\tSystem.out.println(obj);\n\n\t\t\t\tn = n.getChild();\n\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\n\n\t\/**\n\n\t * \u6839\u636e\u6307\u5b9a\u7684\u4f4d\u7f6e\u6765\u524d\u540e\u904d\u5386\n\n\t * \n\n\t * @param index\n\n\t *\/\n\n\tpublic void printLinkNode1(int index) {\n\n\t\tif (index &lt; 0 || index &gt; size()) {\n\n\t\t\tthrow new RuntimeException(\"\u4e0b\u6807\u8d8a\u754c\uff1asize\uff1a\" + size() + \"index\uff1a\" + index);\n\n\t\t}\n\n\n\n\t\tLinkNode nownode = getLinkNode(index);\n\n\t\tLinkNode cnode = nownode.getChild();\n\n\t\tint i = index;\n\n\t\t\/\/ \u5f80\u524d\u904d\u5386\n\n\t\twhile (nownode != null &amp;&amp; i &gt;= 0) {\n\n\t\t\tObject obj = nownode.getObj();\n\n\t\t\tSystem.out.println(obj);\n\n\t\t\ti--;\n\n\t\t\tnownode = nownode.getParent();\n\n\t\t}\n\n\t\tnownode = getLinkNode(index);\n\n\t\t\/\/ \u5f80\u540e\u904d\u5386\n\n\t\twhile (nownode != null &amp;&amp; i &lt; size()) {\n\n\t\t\tObject obj = nownode.getObj();\n\n\t\t\tSystem.out.println(obj);\n\n\t\t\ti++;\n\n\t\t\tnownode = nownode.getChild();\n\n\t\t}\n\n\t}\n\n}<\/code><\/pre>\n<table style=\"display: table; text-align: left; overflow: auto; border-collapse: collapse; margin: 1.4em auto; max-width: 100%; table-layout: fixed; overflow-wrap: break-word; word-break: break-all;\" width=\"800\">\n<thead>\n<tr>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u65b9\u6cd5<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u505a\u4ec0\u4e48<\/th>\n<th style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top; text-align: center; font-weight: bold; color: #4870ac; background: #f7f7f7;\">\u6ce8\u610f<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">add(obj)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5c3e\u63d2<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7a7a\u8868\u65f6 front=last=\u65b0\u7ed3\u70b9<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">add(index, obj)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6307\u5b9a\u4f4d\u7f6e\u63d2<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4e0b\u6807\u8d8a\u754c\u629b RuntimeException\uff1b\u63d2\u5728 size() \u5904\u7b49\u4e8e\u5c3e\u63d2<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">remove(index)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6309\u4f4d\u7f6e\u5220<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6539\u7236\u7ed3\u70b9\u7684 child \u548c\u5b50\u7ed3\u70b9\u7684 parent<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">getLinkNode(index)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4ece\u5934\u8d70\u5230 index<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">O(n)<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">upDate(index, obj)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u6539\u6570\u636e\u57df\uff0c\u4e0d\u6539\u6307\u9488<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u7a7a\u8868\u53ea\u6253\u5370\u63d0\u793a<\/td>\n<\/tr>\n<tr>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">printLinkNode1(index)<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u5148\u5411\u524d\u518d\u5411\u540e<\/td>\n<td style=\"border: 1px solid #d9dfe4; padding: 9px 12px; font-size: 0.75em; line-height: 22px; vertical-align: top;\">\u4f53\u73b0\u53cc\u5411\u94fe\u8868\u7684\u4ef7\u503c<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p style=\"margin: 1em 0px;\">main \u91cc\u5148\u52a0\u5934\u7ed3\u70b9\u518d\u52a0 0\uff5e9 \u5171\u5341\u4e2a\u7ed3\u70b9\uff0c\u53d6\u4e0b\u6807 3 \u7684\u6570\u636e\uff0c\u518d\u5728 3 \u53f7\u4f4d\u63d2\u5165\u300c\u65b0\u6765\u7684\u5143\u7d20\u300d\uff0c\u6253\u5370\u4e00\u904d\u540e\u628a 3 \u53f7\u4f4d\u6539\u6210\u300c\u503c\u88ab\u6539\u53d8\u7684\u5143\u7d20\u300d\uff0c\u6700\u540e\u4ece\u4e0b\u6807 3 \u505a\u53cc\u5411\u904d\u5386\u3002remove \u88ab\u6ce8\u91ca\u6389\u4e86\uff0c\u9700\u8981\u65f6\u53ef\u6253\u5f00\u3002<\/p>\n<blockquote style=\"display: block; font-size: 0.9em; border-left: 3px solid #4870ac; padding: 0.5em 1em; margin: 0px; background: #f6f8fa; color: #40464f;\">\n<p style=\"margin: 1em 0px;\"><strong style=\"color: #4870ac;\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a\u53cc\u5411\u94fe\u8868\u591a\u4ed8\u4e00\u4e2a\u7236\u6307\u9488\uff0c\u6362\u6765\u4ece\u4efb\u610f\u7ed3\u70b9\u5411\u524d\u8d70\uff1b\u63d2\u5165\u5220\u9664\u53ea\u6539\u56db\u6761\u5f15\u7528\uff0c\u67e5\u627e\u4ecd\u8981\u4ece\u5934\u6570\u5230 index\u3002<\/strong><\/p>\n<\/blockquote>\n<\/section>\n","protected":false},"excerpt":{"rendered":"<p>\u5b66\u8fc7\u6570\u636e\u7ed3\u6784\u7684\u4eba\u5bf9\u53cc\u5411\u94fe\u8868\u90fd\u4e0d\u964c\u751f\u3002\u7528 Java \u600e\u4e48\u5b9e\u73b0\uff1f\u94fe\u8868\u5728\u5185\u5b58\u91cc\u5e76\u4e0d\u8fde\u7eed\uff0c\u903b\u8f91\u987a\u5e8f\u9760\u6307\u9488\u4e32\u8d77\u6765\u3002\u6bcf\u4e2a\u7ed3 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[18],"tags":[177],"_links":{"self":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/195"}],"collection":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=195"}],"version-history":[{"count":3,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/195\/revisions"}],"predecessor-version":[{"id":315,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=\/wp\/v2\/posts\/195\/revisions\/315"}],"wp:attachment":[{"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=195"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=195"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ai.zhousir.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=195"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}