{"id":226,"date":"2017-01-17T16:00:00","date_gmt":"2017-01-17T07:00:00","guid":{"rendered":"https:\/\/java-code.jp\/?p=226"},"modified":"2017-01-17T16:00:11","modified_gmt":"2017-01-17T07:00:11","slug":"arraydeque","status":"publish","type":"post","link":"https:\/\/java-code.jp\/226","title":{"rendered":"ArrayDeque"},"content":{"rendered":"<p><em class=\"ccenterContents01\">\u30ad\u30e5\u30fc\uff0f\u30b9\u30bf\u30c3\u30af\u69cb\u9020 &#8211; ArrayDeque\u30af\u30e9\u30b9<\/em><\/p>\n<p>ArrayDeque\u306f<span>\u4e21\u7aef\u30ad\u30e5\u30fc<\/span>\u3068\u3082\u547c\u3070\u308c\u3001\u5148\u982d\u672b\u5c3e\u306e\u53cc\u65b9\u304b\u3089\u8981\u7d20\u3092\u51fa\u3057\u5165\u308c\u3067\u304d\u308b\u30ad\u30e5\u30fc\u306e\u5b9f\u88c5\u3067\u3059\u3002ArrayDeque\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30ad\u30e5\u30fc\uff08FIFO\uff1aFirst In First Out\uff09\u3084\u30b9\u30bf\u30c3\u30af\uff08LIFO\uff1aLast In First Out\uff09\u3068\u3044\u3063\u305f\u30c7\u30fc\u30bf\u69cb\u9020\u3092\u8868\u73fe\u3067\u304d\u307e\u3059\u3002<br \/>\n  ArrayDeque\u30af\u30e9\u30b9\u3067\u5229\u7528\u3067\u304d\u308b\u4e3b\u306a\u30e1\u30bd\u30c3\u30c9\u306b\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u3082\u306e\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<table>\n<tbody>\n<tr>\n<th colspan=\"4\" class=\"tableTitle\">ArrayDeque\u30af\u30e9\u30b9\u306e\u4e3b\u306a\u30e1\u30bd\u30c3\u30c9<\/th>\n<\/tr>\n<tr>\n<th>\u7a2e\u985e<\/th>\n<th>\u5148\u982d<\/th>\n<th>\u672b\u5c3e<\/th>\n<th>\u6982\u8981<\/th>\n<\/tr>\n<tr>\n<td>\u633f\u5165<\/td>\n<td>addFirst(e)<\/td>\n<td>addLast(e)<\/td>\n<td>\u5148\u982d\uff0f\u672b\u5c3e\u306b\u8981\u7d20\u3092\u8ffd\u52a0<\/td>\n<\/tr>\n<tr>\n<td>\u524a\u9664<\/td>\n<td>removeFirst()<\/td>\n<td>removeLast()<\/td>\n<td>\u5148\u982d\uff0f\u672b\u5c3e\u304b\u3089\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3057<\/td>\n<\/tr>\n<tr>\n<td>\u691c\u67fb<\/td>\n<td>getFirst()<\/td>\n<td>getLast()<\/td>\n<td>\u5148\u982d\uff0f\u672b\u5c3e\u306e\u8981\u7d20\u3092\u53d6\u5f97<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u524a\u9664\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u8981\u7d20\u3092\u53d6\u5f97\u3059\u308b\u3068\u5171\u306b\u524a\u9664\u3059\u308b\u306e\u306b\u5bfe\u3057\u3066\u3001\u691c\u67fb\u30e1\u30bd\u30c3\u30c9\u3067\u306f\u8981\u7d20\u3092\u53d6\u5f97\u3059\u308b\u306e\u307f\u3067\u30ad\u30e5\u30fc\u304b\u3089\u524a\u9664\u3057\u307e\u305b\u3093\u3002<br \/>\n  \u4ee5\u4e0b\u306f\u3001ArrayDeque\u3067\u30ad\u30e5\u30fc\uff0f\u30b9\u30bf\u30c3\u30af\u3092\u5b9f\u88c5\u3059\u308b\u4f8b\u3067\u3059\u3002\u30ad\u30e5\u30fc\u306f\u672b\u5c3e\u304b\u3089\u8981\u7d20\u3092\u8ffd\u52a0\u3057\u3001\u5148\u982d\u304b\u3089\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u3067\u3001\u30b9\u30bf\u30c3\u30af\u306f\u3001\u672b\u5c3e\u304b\u3089\u8981\u7d20\u3092\u8ffd\u52a0\u3057\u3001\u672b\u5c3e\u304b\u3089\u8981\u7d20\u3092\u53d6\u308a\u51fa\u3059\u3053\u3068\u3067\u3001\u305d\u308c\u305e\u308c\u8868\u73fe\u3067\u304d\u307e\u3059\u3002<\/p>\n<p class=\"list\">CollQueue.java<\/p>\n<div class=\"pre\">\n<pre class=\"brush:java;highlight:[9,24];\">\r\npackage com.example.mynavi.collection;\r\n\r\nimport java.util.ArrayDeque;\r\nimport java.util.Deque;\r\n\r\npublic class CollQueue {\r\n  public static void main(String[] args) {\r\n    \/\/ \u30ad\u30e5\u30fc\u69cb\u9020\r\n    Deque&lt;String&gt; q = new ArrayDeque&lt;String&gt;();\r\n    q.addLast(\"AAAAA\");\r\n    q.addLast(\"BBBBB\");\r\n    q.addLast(\"CCCCC\");\r\n    System.out.println(q);\t\/\/ \u7d50\u679c\uff1a[AAAAA, BBBBB, CCCCC]\r\n    System.out.println(q.removeFirst());\t\/\/ \u7d50\u679c\uff1aAAAAA\r\n    System.out.println(q);\t\/\/ \u7d50\u679c\uff1a[BBBBB, CCCCC]\r\n\r\n      \/\/ \u30b9\u30bf\u30c3\u30af\u69cb\u9020\r\n    Deque&lt;String&gt; s = new ArrayDeque&lt;String&gt;();\r\n    s.addLast(\"AAAAA\");\r\n    s.addLast(\"BBBBB\");\r\n    s.addLast(\"CCCCC\");\r\n    System.out.println(s);\t\/\/ \u7d50\u679c\uff1a[AAAAA, BBBBB, CCCCC]\r\n    System.out.println(s.removeLast());\t\/\/ \u7d50\u679c\uff1aCCCCC\r\n    System.out.println(s);\t\/\/ \u7d50\u679c\uff1a[AAAAA, BBBBB]\r\n  }\r\n}\r\n<\/pre>\n<p><!-- \/ .pre --><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u30ad\u30e5\u30fc\uff0f\u30b9\u30bf\u30c3\u30af\u69cb\u9020 &#8211; ArrayDeque\u30af\u30e9\u30b9 ArrayDeque\u306f\u4e21\u7aef\u30ad\u30e5\u30fc\u3068\u3082\u547c\u3070\u308c\u3001\u5148\u982d\u672b\u5c3e\u306e\u53cc\u65b9\u304b\u3089\u8981\u7d20\u3092\u51fa\u3057\u5165\u308c\u3067\u304d\u308b\u30ad\u30e5\u30fc\u306e\u5b9f\u88c5\u3067\u3059\u3002ArrayDeque\u3092\u5229\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30ad\u30e5\u30fc\uff08FIFO [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17],"tags":[],"class_list":["post-226","post","type-post","status-publish","format-standard","hentry","category-frame"],"_links":{"self":[{"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/posts\/226"}],"collection":[{"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/comments?post=226"}],"version-history":[{"count":5,"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/posts\/226\/revisions"}],"predecessor-version":[{"id":1094,"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/posts\/226\/revisions\/1094"}],"wp:attachment":[{"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/media?parent=226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/categories?post=226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/java-code.jp\/wp-json\/wp\/v2\/tags?post=226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}