{"id":173,"date":"2014-02-13T01:56:58","date_gmt":"2014-02-12T16:56:58","guid":{"rendered":"http:\/\/kei0310.info\/?p=173"},"modified":"2014-02-13T01:59:47","modified_gmt":"2014-02-12T16:59:47","slug":"java%e5%9f%ba%e6%9c%ac-hashmap%e3%80%81hashset%e3%80%81arraylist%e3%81%ae%e3%83%ab%e3%83%bc%e3%83%97%e5%87%a6%e7%90%86%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab","status":"publish","type":"post","link":"http:\/\/kei0310.info\/?p=173","title":{"rendered":"[java][\u57fa\u672c] HashMap\u3001HashSet\u3001ArrayList\u306e\u30eb\u30fc\u30d7\u51e6\u7406\u30b5\u30f3\u30d7\u30eb"},"content":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306fkei\u3067\u3059\u3002<\/p>\n<p>\u4eca\u56de\u306f\u3001Java\u3092\u66f8\u304f\u4e0a\u3067\u826f\u304f\u4f7f\u3046\u4ee5\u4e0b\uff13\u3064\u306e\u30af\u30e9\u30b9\u306e\u30eb\u30fc\u30d7\u51e6\u7406\u3092\u66f8\u3044\u3066\u307f\u307e\u3059\u3002<br \/>\n\u3093\uff1f\u3068\u601d\u3063\u305f\u3089\u8f9e\u66f8\u7684\u306b\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n<ul>\n<li>HashMap\uff08Map\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\uff09<\/li>\n<li>HashSet\uff08Set\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\uff09<\/li>\n<li>ArrayList\uff08List\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\uff09<\/li>\n<\/ul>\n<p>\u57fa\u672c\u7684\u306b\u3001JavaSE1.5\u3067\u5b9f\u88c5\u3055\u308c\u305f\u62e1\u5f35for\u6587\u3092\u4f7f\u3046\u307b\u3046\u304c\u30b7\u30f3\u30d7\u30eb\u3067\u3059\u304c<br \/>\n\u5ff5\u306e\u305f\u3081\u306bIterator\u3092\u4f7f\u3046\u65b9\u6cd5\u3082\u4f75\u8a18\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n<p>\u307e\u305a\u306f\u3001HashMap\u304b\u3089\u3002<br \/>\n\u4e2d\u8eab\u306e\u578b\u306fString\u306b\u3057\u3066\u3057\u307e\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t\tMap&lt;String, String&gt; map = new HashMap&lt;String, String&gt;();\r\n\r\n\t\tmap.put(&quot;a&quot;, &quot;aa&quot;);\r\n\t\tmap.put(&quot;b&quot;, &quot;bb&quot;);\r\n\t\tmap.put(&quot;c&quot;, &quot;cc&quot;);\r\n\t\tmap.put(&quot;d&quot;, &quot;dd&quot;);\r\n\r\n\t\t\/\/ foreach\uff08\u62e1\u5f35for\u6587\uff09\u3067\u306e\u66f8\u304d\u65b9\r\n\t\tfor(Map.Entry&lt;String, String&gt; entry : map.entrySet()){\r\n\r\n\t\t    \/\/ \u8868\u793a\u51e6\u7406\r\n\t\t\tSystem.out.println(&quot;key=[&quot; + entry.getKey() + &quot;], value=[&quot; + entry.getValue() + &quot;]&quot;);\r\n\t\t}\r\n\r\n\t\t\/\/ Iterator\u3067\u306e\u66f8\u304d\u65b9\r\n\t\tfor(Iterator it = map.keySet().iterator(); it.hasNext(); ) {\r\n\t\t\tString key = it.next();\r\n\t\t    \/\/ \u8868\u793a\u51e6\u7406\r\n\t\t\tSystem.out.println(&quot;key=[&quot; + key + &quot;], value=[&quot; + map.get(key) + &quot;]&quot;);\r\n\t\t}\r\n<\/pre>\n<\/h6>\n<p>\u6b21\u306bHashSet\u306e\u30eb\u30fc\u30d7\u306e\u66f8\u304d\u65b9\u3067\u3059\u3002<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t\tSet&lt;String&gt; set = new HashSet&lt;String&gt;();\r\n\r\n\t\tset.add(&quot;a&quot;);\r\n\t\tset.add(&quot;b&quot;);\r\n\t\tset.add(&quot;c&quot;);\r\n\t\tset.add(&quot;d&quot;);\r\n\r\n\t\t\/\/ foreach\uff08\u62e1\u5f35for\u6587\uff09\u3067\u306e\u66f8\u304d\u65b9\r\n\t\tfor(String value : set){\r\n\r\n\t\t    \/\/ \u8868\u793a\u51e6\u7406\r\n\t\t\tSystem.out.println(&quot;value=[&quot; + value + &quot;]&quot;);\r\n\t\t}\r\n\r\n\t\t\/\/ Iterator\u3067\u306e\u66f8\u304d\u65b9\r\n\t\tfor(Iterator it = set.iterator(); it.hasNext(); ) {\r\n\t\t\tString value = it.next();\r\n\t\t    \/\/ \u8868\u793a\u51e6\u7406\r\n\t\t\tSystem.out.println(&quot;value=[&quot; + value + &quot;]&quot;);\r\n\t\t}\r\n<\/pre>\n<\/h6>\n<p>\u6700\u5f8c\u306bArrayList\u306e\u30eb\u30fc\u30d7\u51e6\u7406\u3067\u3059\u3002<br \/>\nSet\u306f\u5b9f\u8cea\u7684\u306b\u3001\u9806\u756a\u304c\u4fdd\u969c\u3055\u308c\u3066\u3044\u306a\u3044\u91cd\u8907\u306e\u7121\u3044List\u306e\u3088\u3046\u306a\u30c7\u30fc\u30bf\u69cb\u9020\u306a\u306e\u3067\u3001<br \/>\n\u30b3\u30fc\u30c9\u3082\u5168\u304f\u540c\u3058\u3067\u3059\u3002<\/p>\n<h6>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n\t\tList&lt;String&gt; list = new ArrayList&lt;String&gt;();\r\n\r\n\t\tlist.add(&quot;a&quot;);\r\n\t\tlist.add(&quot;b&quot;);\r\n\t\tlist.add(&quot;c&quot;);\r\n\t\tlist.add(&quot;d&quot;);\r\n\r\n\t\t\/\/ foreach\uff08\u62e1\u5f35for\u6587\uff09\u3067\u306e\u66f8\u304d\u65b9\r\n\t\tfor(String value : list){\r\n\r\n\t\t    \/\/ \u8868\u793a\u51e6\u7406\r\n\t\t\tSystem.out.println(&quot;value=[&quot; + value + &quot;]&quot;);\r\n\t\t}\r\n\r\n\t\t\/\/ Iterator\u3067\u306e\u66f8\u304d\u65b9\r\n\t\tfor(Iterator it = list.iterator(); it.hasNext(); ) {\r\n\t\t\tString value = it.next();\r\n\t\t    \/\/ \u8868\u793a\u51e6\u7406\r\n\t\t\tSystem.out.println(&quot;value=[&quot; + value + &quot;]&quot;);\r\n\t\t}\r\n<\/pre>\n<\/h6>\n<p>\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3093\u306b\u3061\u306fkei\u3067\u3059\u3002 \u4eca\u56de\u306f\u3001Java\u3092\u66f8\u304f\u4e0a\u3067\u826f\u304f\u4f7f\u3046\u4ee5\u4e0b\uff13\u3064\u306e\u30af\u30e9\u30b9\u306e\u30eb\u30fc\u30d7\u51e6\u7406\u3092\u66f8\u3044\u3066\u307f\u307e\u3059\u3002 \u3093\uff1f\u3068\u601d\u3063\u305f\u3089\u8f9e\u66f8\u7684\u306b\u4f7f\u3063\u3066\u304f\u3060\u3055\u3044\u3002 HashMap\uff08Map\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7\u30fc\u30b9\uff09 HashSet\uff08Set\u30a4\u30f3\u30bf\u30fc\u30d5\u30a7 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[34,35,36,183,32,31,33,30],"_links":{"self":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts\/173"}],"collection":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=173"}],"version-history":[{"count":4,"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions"}],"predecessor-version":[{"id":177,"href":"http:\/\/kei0310.info\/index.php?rest_route=\/wp\/v2\/posts\/173\/revisions\/177"}],"wp:attachment":[{"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=173"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kei0310.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}