{"id":2254,"date":"2025-03-02T18:41:07","date_gmt":"2025-03-02T10:41:07","guid":{"rendered":"https:\/\/www.laixuexila.com\/?p=2254"},"modified":"2025-03-02T18:41:07","modified_gmt":"2025-03-02T10:41:07","slug":"java-linkedlist","status":"publish","type":"post","link":"https:\/\/www.laixuexila.com\/index.php\/2025\/03\/02\/java-linkedlist\/","title":{"rendered":"Java LinkedList"},"content":{"rendered":"\n<p><code>LinkedList<\/code> \u662f Java \u96c6\u5408\u6846\u67b6\u4e2d\u5b9e\u73b0\u4e86 <code>List<\/code>\u3001<code>Deque<\/code> \u548c <code>Queue<\/code> \u63a5\u53e3\u7684\u7c7b\uff0c\u5b83\u57fa\u4e8e\u53cc\u5411\u94fe\u8868\u5b9e\u73b0\uff0c\u80fd\u591f\u9ad8\u6548\u5730\u652f\u6301\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u3002\u4e0e <code>ArrayList<\/code> \u57fa\u4e8e\u52a8\u6001\u6570\u7ec4\u4e0d\u540c\uff0c<code>LinkedList<\/code> \u5728\u63d2\u5165\u548c\u5220\u9664\u5143\u7d20\u65f6\uff0c\u6027\u80fd\u8f83\u4f18\uff0c\u4f46\u968f\u673a\u8bbf\u95ee\u6027\u80fd\u8f83\u5dee\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1. <strong>LinkedList \u7684\u57fa\u672c\u7279\u6027<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u57fa\u4e8e\u94fe\u8868\u5b9e\u73b0<\/strong>\uff1a<code>LinkedList<\/code> \u4f7f\u7528\u53cc\u5411\u94fe\u8868\u6765\u5b58\u50a8\u5143\u7d20\uff0c\u6bcf\u4e2a\u8282\u70b9\u90fd\u5305\u542b\u5bf9\u524d\u4e00\u4e2a\u548c\u4e0b\u4e00\u4e2a\u8282\u70b9\u7684\u5f15\u7528\u3002<\/li>\n\n\n\n<li><strong>\u5143\u7d20\u63d2\u5165\u548c\u5220\u9664\u6027\u80fd<\/strong>\uff1a\u5728\u5934\u90e8\u6216\u5c3e\u90e8\u63d2\u5165\u548c\u5220\u9664\u5143\u7d20\u65f6\uff0c<code>LinkedList<\/code> \u6bd4 <code>ArrayList<\/code> \u66f4\u52a0\u9ad8\u6548\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u662f O(1)\u3002<\/li>\n\n\n\n<li><strong>\u968f\u673a\u8bbf\u95ee\u6027\u80fd\u5dee<\/strong>\uff1a\u7531\u4e8e\u94fe\u8868\u7ed3\u6784\u4e0d\u80fd\u76f4\u63a5\u6309\u7d22\u5f15\u8bbf\u95ee\u5143\u7d20\uff0c\u9700\u8981\u904d\u5386\u94fe\u8868\uff0c\u56e0\u6b64\u8bbf\u95ee\u67d0\u4e2a\u5143\u7d20\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f O(n)\u3002<\/li>\n\n\n\n<li><strong>\u5141\u8bb8\u5b58\u50a8 null<\/strong>\uff1a<code>LinkedList<\/code> \u53ef\u4ee5\u5b58\u50a8 <code>null<\/code> \u5143\u7d20\u3002<\/li>\n\n\n\n<li><strong>\u53cc\u5411\u94fe\u8868<\/strong>\uff1a\u6bcf\u4e2a\u8282\u70b9\u5305\u542b\u4e24\u4e2a\u5f15\u7528\uff1a\u4e00\u4e2a\u6307\u5411\u524d\u4e00\u4e2a\u8282\u70b9\uff0c\u4e00\u4e2a\u6307\u5411\u4e0b\u4e00\u4e2a\u8282\u70b9\uff0c\u8fd9\u4f7f\u5f97 <code>LinkedList<\/code> \u652f\u6301\u4ece\u4e24\u7aef\u64cd\u4f5c\uff08\u5982\u53cc\u7aef\u961f\u5217 <code>Deque<\/code>\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">2. <strong>LinkedList \u7684\u5e38\u7528\u6784\u9020\u51fd\u6570<\/strong><\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ \u9ed8\u8ba4\u6784\u9020\u51fd\u6570\uff0c\u521b\u5efa\u4e00\u4e2a\u7a7a\u7684 LinkedList\nLinkedList&lt;E&gt; list = new LinkedList&lt;&gt;();\n\n\/\/ \u57fa\u4e8e\u53e6\u4e00\u4e2a\u96c6\u5408\u521b\u5efa LinkedList\nLinkedList&lt;E&gt; list = new LinkedList&lt;&gt;(Collection&lt;? extends E&gt; c);<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">3. <strong>LinkedList \u5e38\u7528\u65b9\u6cd5<\/strong><\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">3.1 <strong>\u6dfb\u52a0\u5143\u7d20<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>add(E e)<\/code>\uff1a\u5c06\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u7684\u672b\u5c3e\u3002<\/li>\n\n\n\n<li><code>addFirst(E e)<\/code>\uff1a\u5c06\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u7684\u5934\u90e8\u3002<\/li>\n\n\n\n<li><code>addLast(E e)<\/code>\uff1a\u5c06\u5143\u7d20\u6dfb\u52a0\u5230\u5217\u8868\u7684\u5c3e\u90e8\u3002<\/li>\n\n\n\n<li><code>offer(E e)<\/code>\uff1a\u5c06\u5143\u7d20\u63d2\u5165\u961f\u5217\u672b\u5c3e\uff08\u4e0e <code>add(E e)<\/code> \u7c7b\u4f3c\uff0c\u4f46\u7528\u4e8e\u961f\u5217\u63a5\u53e3\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>LinkedList&lt;String&gt; list = new LinkedList&lt;&gt;();\nlist.add(\"Apple\");\nlist.addFirst(\"Banana\");  \/\/ \u63d2\u5165\u5230\u5934\u90e8\nlist.addLast(\"Orange\");   \/\/ \u63d2\u5165\u5230\u5c3e\u90e8<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.2 <strong>\u5220\u9664\u5143\u7d20<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>remove()<\/code>\uff1a\u79fb\u9664\u5e76\u8fd4\u56de\u5217\u8868\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\uff08\u961f\u5217\u64cd\u4f5c\uff09\u3002<\/li>\n\n\n\n<li><code>removeFirst()<\/code>\uff1a\u79fb\u9664\u5e76\u8fd4\u56de\u5217\u8868\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>removeLast()<\/code>\uff1a\u79fb\u9664\u5e76\u8fd4\u56de\u5217\u8868\u4e2d\u7684\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>remove(Object o)<\/code>\uff1a\u5220\u9664\u7b2c\u4e00\u6b21\u51fa\u73b0\u7684\u6307\u5b9a\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>clear()<\/code>\uff1a\u6e05\u7a7a <code>LinkedList<\/code> \u4e2d\u7684\u6240\u6709\u5143\u7d20\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>list.remove();          \/\/ \u5220\u9664\u5e76\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5143\u7d20\nlist.removeFirst();     \/\/ \u5220\u9664\u5e76\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5143\u7d20\nlist.removeLast();      \/\/ \u5220\u9664\u5e76\u8fd4\u56de\u6700\u540e\u4e00\u4e2a\u5143\u7d20\nlist.remove(\"Banana\");  \/\/ \u5220\u9664 \"Banana\"\nlist.clear();           \/\/ \u6e05\u7a7a LinkedList<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.3 <strong>\u8bbf\u95ee\u5143\u7d20<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>get(int index)<\/code>\uff1a\u83b7\u53d6\u6307\u5b9a\u7d22\u5f15\u4f4d\u7f6e\u7684\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>getFirst()<\/code>\uff1a\u83b7\u53d6\u5217\u8868\u4e2d\u7684\u7b2c\u4e00\u4e2a\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>getLast()<\/code>\uff1a\u83b7\u53d6\u5217\u8868\u4e2d\u7684\u6700\u540e\u4e00\u4e2a\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>peek()<\/code>\uff1a\u83b7\u53d6\u5e76\u8fd4\u56de\u7b2c\u4e00\u4e2a\u5143\u7d20\uff0c\u4f46\u4e0d\u5220\u9664\uff08\u7528\u4e8e\u961f\u5217\u64cd\u4f5c\uff09\u3002<\/li>\n\n\n\n<li><code>poll()<\/code>\uff1a\u83b7\u53d6\u5e76\u5220\u9664\u7b2c\u4e00\u4e2a\u5143\u7d20\uff08\u7528\u4e8e\u961f\u5217\u64cd\u4f5c\uff09\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>String firstFruit = list.getFirst(); \/\/ \u83b7\u53d6\u7b2c\u4e00\u4e2a\u5143\u7d20\nString lastFruit = list.getLast();  \/\/ \u83b7\u53d6\u6700\u540e\u4e00\u4e2a\u5143\u7d20\nString fruit = list.get(1);         \/\/ \u83b7\u53d6\u6307\u5b9a\u7d22\u5f15\u4f4d\u7f6e\u7684\u5143\u7d20<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.4 <strong>\u67e5\u8be2\u5143\u7d20<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>contains(Object o)<\/code>\uff1a\u68c0\u67e5\u5217\u8868\u662f\u5426\u5305\u542b\u67d0\u4e2a\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>indexOf(Object o)<\/code>\uff1a\u8fd4\u56de\u6307\u5b9a\u5143\u7d20\u9996\u6b21\u51fa\u73b0\u7684\u7d22\u5f15\uff0c\u5982\u679c\u6ca1\u6709\u627e\u5230\u8fd4\u56de -1\u3002<\/li>\n\n\n\n<li><code>lastIndexOf(Object o)<\/code>\uff1a\u8fd4\u56de\u6307\u5b9a\u5143\u7d20\u6700\u540e\u4e00\u6b21\u51fa\u73b0\u7684\u7d22\u5f15\u3002<\/li>\n\n\n\n<li><code>size()<\/code>\uff1a\u8fd4\u56de <code>LinkedList<\/code> \u4e2d\u7684\u5143\u7d20\u4e2a\u6570\u3002<\/li>\n\n\n\n<li><code>isEmpty()<\/code>\uff1a\u5224\u65ad <code>LinkedList<\/code> \u662f\u5426\u4e3a\u7a7a\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>boolean containsApple = list.contains(\"Apple\"); \/\/ \u68c0\u67e5\u662f\u5426\u5305\u542b \"Apple\"\nint index = list.indexOf(\"Banana\"); \/\/ \u83b7\u53d6 \"Banana\" \u7684\u7d22\u5f15\nint size = list.size(); \/\/ \u83b7\u53d6 LinkedList \u7684\u5927\u5c0f\nboolean isEmpty = list.isEmpty(); \/\/ \u5224\u65ad\u662f\u5426\u4e3a\u7a7a<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.5 <strong>\u904d\u5386\u5143\u7d20<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <strong>for-each<\/strong> \u5faa\u73af\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>for (String fruit : list) {\n    System.out.println(fruit);\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <strong>Iterator<\/strong>\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Iterator&lt;String&gt; iterator = list.iterator();\nwhile (iterator.hasNext()) {\n    System.out.println(iterator.next());\n}<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <strong>for<\/strong> \u5faa\u73af\uff1a<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>for (int i = 0; i &lt; list.size(); i++) {\n    System.out.println(list.get(i));\n}<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.6 <strong>\u8f6c\u6362\u4e3a\u6570\u7ec4<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>toArray()<\/code>\uff1a\u5c06 <code>LinkedList<\/code> \u8f6c\u6362\u4e3a\u6570\u7ec4\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Object&#91;] array = list.toArray();<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>toArray(T[] a)<\/code>\uff1a\u5c06 <code>LinkedList<\/code> \u8f6c\u6362\u4e3a\u6307\u5b9a\u7c7b\u578b\u7684\u6570\u7ec4\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>String&#91;] array = list.toArray(new String&#91;0]);<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">3.7 <strong>\u5176\u4ed6\u5e38\u7528\u65b9\u6cd5<\/strong><\/h4>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>removeAll(Collection&lt;?> c)<\/code>\uff1a\u5220\u9664\u5217\u8868\u4e2d\u6240\u6709\u4e0e\u7ed9\u5b9a\u96c6\u5408 <code>c<\/code> \u76f8\u540c\u7684\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>retainAll(Collection&lt;?> c)<\/code>\uff1a\u4fdd\u7559\u5217\u8868\u4e2d\u6240\u6709\u4e0e\u7ed9\u5b9a\u96c6\u5408 <code>c<\/code> \u76f8\u540c\u7684\u5143\u7d20\u3002<\/li>\n\n\n\n<li><code>subList(int fromIndex, int toIndex)<\/code>\uff1a\u8fd4\u56de\u6307\u5b9a\u8303\u56f4\u7684\u5b50\u5217\u8868\uff08\u4e0d\u5305\u62ec <code>toIndex<\/code>\uff09\u3002<\/li>\n\n\n\n<li><code>offerFirst(E e)<\/code>\uff1a\u5c06\u5143\u7d20\u6dfb\u52a0\u5230\u961f\u5217\u5934\u90e8\u3002<\/li>\n\n\n\n<li><code>offerLast(E e)<\/code>\uff1a\u5c06\u5143\u7d20\u6dfb\u52a0\u5230\u961f\u5217\u5c3e\u90e8\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">4. <strong>LinkedList \u7684\u6027\u80fd<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u8bbf\u95ee\u5143\u7d20<\/strong>\uff1a\u7531\u4e8e <code>LinkedList<\/code> \u662f\u57fa\u4e8e\u94fe\u8868\u7ed3\u6784\u7684\uff0c\u8bbf\u95ee\u6307\u5b9a\u7d22\u5f15\u7684\u5143\u7d20\u9700\u8981\u904d\u5386\u94fe\u8868\uff0c\u56e0\u6b64\u65f6\u95f4\u590d\u6742\u5ea6\u662f O(n)\u3002<\/li>\n\n\n\n<li><strong>\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c<\/strong>\uff1a\u5728\u94fe\u8868\u7684\u5934\u90e8\u548c\u5c3e\u90e8\u63d2\u5165\u6216\u5220\u9664\u5143\u7d20\u7684\u65f6\u95f4\u590d\u6742\u5ea6\u662f O(1)\uff0c\u800c\u5728\u94fe\u8868\u4e2d\u95f4\u63d2\u5165\u6216\u5220\u9664\u5143\u7d20\u9700\u8981\u904d\u5386\u94fe\u8868\uff0c\u65f6\u95f4\u590d\u6742\u5ea6\u662f O(n)\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">5. <strong>LinkedList \u4e0e ArrayList \u7684\u6bd4\u8f83<\/strong><\/h3>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><thead><tr><th>\u7279\u6027<\/th><th><code>LinkedList<\/code><\/th><th><code>ArrayList<\/code><\/th><\/tr><\/thead><tbody><tr><td><strong>\u5e95\u5c42\u5b9e\u73b0<\/strong><\/td><td>\u53cc\u5411\u94fe\u8868<\/td><td>\u52a8\u6001\u6570\u7ec4<\/td><\/tr><tr><td><strong>\u8bbf\u95ee\u5143\u7d20<\/strong><\/td><td>\u968f\u673a\u8bbf\u95ee\u6162\uff0cO(n)<\/td><td>\u968f\u673a\u8bbf\u95ee\u5feb\uff0cO(1)<\/td><\/tr><tr><td><strong>\u63d2\u5165\/\u5220\u9664\u64cd\u4f5c<\/strong><\/td><td>\u5728\u5934\u90e8\u6216\u5c3e\u90e8\u63d2\u5165\u5220\u9664\u5feb\uff0cO(1)<\/td><td>\u5728\u5934\u90e8\u6216\u4e2d\u95f4\u63d2\u5165\u5220\u9664\u6162\uff0cO(n)<\/td><\/tr><tr><td><strong>\u5185\u5b58\u5360\u7528<\/strong><\/td><td>\u6bcf\u4e2a\u8282\u70b9\u9700\u8981\u989d\u5916\u5b58\u50a8\u524d\u540e\u8282\u70b9\u5f15\u7528<\/td><td>\u5185\u5b58\u8f83\u4e3a\u7d27\u51d1\uff0c\u53ea\u9700\u8981\u5b58\u50a8\u6570\u636e<\/td><\/tr><tr><td><strong>\u9002\u7528\u573a\u666f<\/strong><\/td><td>\u9891\u7e41\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\uff0c\u5c24\u5176\u662f\u5728\u5934\u5c3e\u4f4d\u7f6e<\/td><td>\u9891\u7e41\u8bfb\u53d6\u64cd\u4f5c\uff0c\u5c11\u91cf\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">6. <strong>\u7ebf\u7a0b\u5b89\u5168\u95ee\u9898<\/strong><\/h3>\n\n\n\n<p><code>LinkedList<\/code> \u4e0d\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\u3002\u5982\u679c\u9700\u8981\u5728\u591a\u7ebf\u7a0b\u73af\u5883\u4e2d\u4f7f\u7528 <code>LinkedList<\/code>\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u4fdd\u8bc1\u7ebf\u7a0b\u5b89\u5168\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4f7f\u7528 <code>Collections.synchronizedList()<\/code> \u5c06 <code>LinkedList<\/code> \u5305\u88c5\u6210\u7ebf\u7a0b\u5b89\u5168\u7684\u5217\u8868\u3002<\/li>\n\n\n\n<li>\u4f7f\u7528 <code>CopyOnWriteArrayList<\/code>\uff0c\u5b83\u662f\u7ebf\u7a0b\u5b89\u5168\u7684 <code>List<\/code> \u5b9e\u73b0\uff0c\u9002\u7528\u4e8e\u8bfb\u53d6\u9891\u7e41\u3001\u4fee\u6539\u8f83\u5c11\u7684\u573a\u666f\u3002<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>List&lt;String&gt; synchronizedList = Collections.synchronizedList(new LinkedList&lt;&gt;());<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">7. <strong>\u4f7f\u7528 LinkedList \u7684\u573a\u666f<\/strong><\/h3>\n\n\n\n<p><code>LinkedList<\/code> \u9002\u5408\u4ee5\u4e0b\u573a\u666f\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>\u9891\u7e41\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c<\/strong>\uff1a\u7279\u522b\u662f\u5f53\u63d2\u5165\u548c\u5220\u9664\u64cd\u4f5c\u53d1\u751f\u5728\u94fe\u8868\u7684\u5934\u90e8\u6216\u5c3e\u90e8\u65f6\uff0c<code>LinkedList<\/code> \u7684\u6027\u80fd\u4f18\u4e8e <code>ArrayList<\/code>\u3002<\/li>\n\n\n\n<li><strong>\u53cc\u7aef\u961f\u5217\u64cd\u4f5c\uff08Deque\uff09<\/strong>\uff1a\u7531\u4e8e <code>LinkedList<\/code> \u5b9e\u73b0\u4e86 <code>Deque<\/code> \u63a5\u53e3\uff0c\u5b83\u53ef\u4ee5\u7528\u4f5c\u53cc\u7aef\u961f\u5217\uff0c\u652f\u6301\u4ece\u4e24\u7aef\u8fdb\u884c\u63d2\u5165\u548c\u5220\u9664\u3002<\/li>\n\n\n\n<li><strong>\u961f\u5217\u64cd\u4f5c<\/strong>\uff1a<code>LinkedList<\/code> \u4e5f\u5b9e\u73b0\u4e86 <code>Queue<\/code> \u63a5\u53e3\uff0c\u9002\u7528\u4e8e\u9700\u8981\u6309\u987a\u5e8f\u5904\u7406\u5143\u7d20\u7684\u573a\u666f\uff0c\u5982\u4efb\u52a1\u8c03\u5ea6\u3001\u6d88\u606f\u961f\u5217\u7b49\u3002<\/li>\n<\/ul>\n\n\n\n<h3 class=\"wp-block-heading\">\u5c0f\u7ed3<\/h3>\n\n\n\n<p><code>LinkedList<\/code> \u662f\u4e00\u4e2a\u7075\u6d3b\u4e14\u9ad8\u6548\u7684\u96c6\u5408\u7c7b\uff0c\u7279\u522b\u9002\u7528\u4e8e\u9700\u8981\u9891\u7e41\u63d2\u5165\u548c\u5220\u9664\u5143\u7d20\u7684\u573a\u666f\u3002\u5c3d\u7ba1\u5b83\u7684\u968f\u673a\u8bbf\u95ee\u6027\u80fd\u8f83\u5dee\uff0c\u4f46\u5728\u94fe\u8868\u5934\u90e8\u548c\u5c3e\u90e8\u7684\u63d2\u5165\u4e0e\u5220\u9664\u64cd\u4f5c\u975e\u5e38\u9ad8\u6548\u3002\u5982\u679c\u9700\u8981\u4f18\u5316\u968f\u673a\u8bbf\u95ee\u6027\u80fd\uff0c\u53ef\u4ee5\u8003\u8651\u4f7f\u7528 <code>ArrayList<\/code>\u3002\u5bf9\u4e8e\u961f\u5217\u3001\u6808\u548c\u53cc\u7aef\u961f\u5217\u7b49\u5e94\u7528\u573a\u666f\uff0c<code>LinkedList<\/code> \u4e5f\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u9009\u62e9\u3002\u66f4\u591a\u8be6\u7ec6\u5185\u5bb9\u8bf7\u5173\u6ce8\u5176\u4ed6\u76f8\u5173\u6587\u7ae0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>LinkedList \u662f Java \u96c6\u5408\u6846\u67b6\u4e2d\u5b9e\u73b0\u4e86 List\u3001Deque \u548c Queue \u63a5\u53e3\u7684\u7c7b\uff0c\u5b83\u57fa\u4e8e\u53cc [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[68],"tags":[],"class_list":["post-2254","post","type-post","status-publish","format-standard","hentry","category-java"],"_links":{"self":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/2254","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/comments?post=2254"}],"version-history":[{"count":1,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/2254\/revisions"}],"predecessor-version":[{"id":2255,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/posts\/2254\/revisions\/2255"}],"wp:attachment":[{"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/media?parent=2254"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/categories?post=2254"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.laixuexila.com\/index.php\/wp-json\/wp\/v2\/tags?post=2254"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}