{"id":2063,"date":"2018-05-02T23:47:08","date_gmt":"2018-05-02T14:47:08","guid":{"rendered":"http:\/\/www.code-magagine.com\/?p=2063"},"modified":"2023-05-27T20:40:10","modified_gmt":"2023-05-27T11:40:10","slug":"%e3%80%90java%e3%80%91%e5%9e%8b%e3%81%ae%e5%ad%98%e5%9c%a8%e6%84%8f%e7%be%a9%e3%81%ab%e3%81%a4%e3%81%84%e3%81%a6","status":"publish","type":"post","link":"http:\/\/www.code-magagine.com\/?p=2063","title":{"rendered":"\u3010Java\u3011\u30b8\u30a7\u30cd\u30ea\u30af\u30b9(<>)\u3063\u3066\u4f55\uff1f\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u7b49\u3002"},"content":{"rendered":"<p>Java\u306f\u3001\u578b\u3092\u5fc5\u305a\u5ba3\u8a00\u3059\u308b\u578b\u304c\u53b3\u683c\u306a\u8a00\u8a9e\u3060\u3068\u3088\u304f\u8a00\u308f\u308c\u307e\u3059\u3088\u306d\u3002<\/p>\n<p>\u305d\u3082\u305d\u3082\u3001\u578b\u306e\u5b58\u5728\u7570\u8b70\u3084\u3001\u30e1\u30ea\u30c3\u30c8\u3063\u3066\u306a\u3093\u3067\u3057\u3087\u3046\u304b\u3002<\/p>\n<h2>\u578b\u306e\u30e1\u30ea\u30c3\u30c8<\/h2>\n<p>int\u578b\u306b\u306f\u3001int\u3001String\u306b\u306f\u6587\u5b57\u5217\u3068\u3044\u3046\u3088\u3046\u306b<span style=\"color: #ff0000;\"><strong>\u300c\u683c\u7d0d\u3059\u308b\u30c7\u30fc\u30bf\u306b\u5236\u7d04\u3092\u304b\u3051\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u70b9\u300d<\/strong><span style=\"color: #000000;\">\u3067\u3059\u3002<\/span><\/span><\/p>\n<p>\u4f8b\u3048\u3070\u3001\u30e1\u30bd\u30c3\u30c9\u306e\u5f15\u6570\u304c\u4e8c\u3064\u3042\u3063\u3066\u3001\u3069\u3061\u3089\u3082Object\u578b\uff08\u578b\u3092\u4f55\u3067\u3082\u8a31\u5bb9\u3059\u308b\u578b\uff09\u306b\u306a\u3063\u3066\u3044\u305f\u3089\u3001\u305d\u308c\u3060\u3051\u3067\u30b3\u30f3\u30d1\u30a4\u30eb\u306f\u901a\u3063\u3066\u3057\u307e\u3044\u3001\u91cd\u5927\u306a\u30df\u30b9\u306e\u767a\u898b\u304c\u5f8c\u56de\u3057\u306b\u306a\u3063\u3066\u3057\u307e\u3044\u304b\u306d\u307e\u305b\u3093\u3002<\/p>\n<h2>\u30b8\u30a7\u30cd\u30ea\u30af\u30b9(\u4eee\u578b\u5f15\u6570)\u306b\u3064\u3044\u3066<\/h2>\n<p>\u4f8b\u3048\u3070\u3001ArrayList\u3092\u4f7f\u3046\u5834\u5408\u306f\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b(&lt;\uff5e&gt;)\u3092\u7528\u3044\u308b\u3068\u601d\u3044\u307e\u3059\u3002\u3053\u308c\u3092\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u30b8\u30a7\u30cd\u30ea\u30af\u30b9\u300d\uff08\u4eee\u578b\u5f15\u6570\uff09<\/strong><\/span>\u3068\u547c\u3073\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">ArrayList&lt;String&gt; list = new ArrayList&lt;String&gt;();<\/pre>\n<p>\u3053\u306e\u30b8\u30a7\u30cd\u30ea\u30af\u30b9\u306f\u3001Java\u306e\u6587\u6cd5\u306e\u4e00\u3064\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u30af\u30e9\u30b9\u306e\u578b\u304c\u307e\u3060\u6c7a\u307e\u3063\u3066\u3044\u306a\u3044\u304c\u3001\u4f7f\u3046\u6642\u306f\u578b\u3092\u56fa\u5b9a\u3057\u3066\u4f7f\u3044\u307e\u3059\u3088\u3068\u3044\u3046\u3053\u3068\u304c\u3067\u304d\u308b\u65b9\u6cd5<\/strong><\/span>\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001ArrayList\u306eAPI\u30ea\u30d5\u30a1\u30ec\u30f3\u30b9\u3092\u898b\u308b\u3068\u3001\u4e0b\u8a18\u306e\u3088\u3046\u306b<span style=\"color: #ff0000;\"><strong>\u300c&lt;E&gt;\u300d<\/strong><\/span>\u3068\u3044\u3046\u8868\u8a18\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u3002<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"alignnone size-full wp-image-2079\" src=\"http:\/\/www.code-magagine.com\/wp-content\/uploads\/2018\/05\/ArrayList.png\" alt=\"\" width=\"203\" height=\"75\" \/><\/p>\n<p>\u300cE\u300d\u306f\u3001\u5b9f\u969b\u306b\u300cP\u300d\u3067\u3082\u3001\u300cC\u300d\u3067\u3082\u4f55\u3067\u3082\u3088\u3044\u306e\u3067\u3059\u304c\u3001<span style=\"color: #ff0000;\"><strong>\u73fe\u6642\u70b9\u3067\u578b\u304c\u307e\u3060\u6c7a\u307e\u3063\u3066\u3044\u307e\u305b\u3093\u3088<\/strong><\/span>\u3068\u3044\u3046\u610f\u5473\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<p>\u306a\u306e\u3067\u3001ArrayList\u306b\u306f\u3001String\u578b\u3060\u3063\u305f\u308a\u3001Integer\u578b\u3060\u3063\u305f\u308a\u3001<span style=\"color: #ff0000;\"><strong>\u8272\u3005\u306a\u578b\u3092\u4ee3\u5165\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u308f\u3051<\/strong><\/span>\u3067\u3059\u306d\u3002<\/p>\n<h3>\u5b9f\u969b\u306b\u30b8\u30a7\u30cd\u30ea\u30af\u30b9\u3092\u7528\u3044\u305f\u30af\u30e9\u30b9\u3092\u4f5c\u3063\u3066\u307f\u308b\u3002<\/h3>\n<p>Java\u306e\u6587\u6cd5\u306a\u306e\u3067\u3001\u30b8\u30a7\u30cd\u30ea\u30af\u30b9\u3092\u4f7f\u3063\u305f\u30af\u30e9\u30b9\u3092\u3082\u3061\u308d\u3093\u81ea\u4f5c\u3067\u304d\u307e\u3059\u3002<\/p>\n<pre class=\"lang:default decode:true\">public class Generics&lt;E&gt; {\r\n\r\n\tprivate E data;\r\n\r\n\tpublic E getData() {\r\n\t\treturn data;\r\n\t}\r\n\r\n\tpublic void setData(E data) {\r\n\t\tthis.data = data;\r\n\t}\r\n\r\n}<\/pre>\n<p>\u4e0a\u8a18\u306e\u3088\u3046\u306b\u3001\u30af\u30e9\u30b9\u306b\u300c&lt;E&gt;\u300d\u3068\u3064\u3051\u3066\u3042\u3052\u308b\u3053\u3068\u3067\u3001\u305d\u306e\u300c\uff25\u300d\u3092\u4e00\u5f8b\u30af\u30e9\u30b9\u306e\u4e2d\u3067\u540c\u3058\u6c7a\u307e\u3063\u3066\u3044\u306a\u3044\u578b\u3068\u3057\u3066\u6271\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4e0b\u8a18\u306e\u3088\u3046\u306b\u3057\u3066\u3001\u578b\u3092String\u6c7a\u3081\u3066\u3042\u3052\u3066\u3001\u5ba3\u8a00\u3059\u308b\u3053\u3068\u3067String\u578b\u306e\u30af\u30e9\u30b9\u3068\u3057\u3066\u4f7f\u3046\u3053\u3068\u304c\u51fa\u6765\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3057\u305f\u306d\u3002<\/p>\n<pre class=\"lang:default decode:true\">Generics&lt;String&gt; gene = new Generics&lt;String&gt;();\r\ngene.setData(\"\u3042\");\r\nSystem.out.println(gene.getData());<\/pre>\n<h3>\u30b8\u30a7\u30cd\u30ea\u30af\u30b9\u306e\u30e1\u30ea\u30c3\u30c8<\/h3>\n<p>\u3053\u308c\u3082\u3001<span style=\"color: #ff0000;\"><strong>\u300c\u578b\u5b89\u5168\u300d\u306e\u4e00\u7a2e<\/strong><\/span>\u3067\u3059\u3002\u4e0a\u306e\u4f8b\u3067\u8a00\u3048\u3070\u3001ArrayList\u306b\u3001String\u578b\u306e\u307f\u3057\u304b\u4ee3\u5165\u3059\u308b\u3053\u3068\u3092\u3055\u305b\u306a\u304f\u3057\u307e\u3059\u3002<\/p>\n<p>\u901a\u5e38\u306eint\u3084\u3001String\u7b49\u306e\u578b\u3068\u9055\u3063\u3066\u3001<span style=\"color: #ff0000;\"><strong>\u30af\u30e9\u30b9\u5185\u306b\u307e\u3068\u3081\u3066\u578b\u3092\u5ba3\u8a00\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u308b<\/strong><\/span>\u306e\u304c\u30e1\u30ea\u30c3\u30c8\u3067\u3001<span style=\"color: #ff0000;\"><strong>\u4f5c\u3063\u305f\u30af\u30e9\u30b9\u306e\u6c4e\u7528\u6027\u3082\u4e0a\u3052\u3064\u3064\u3001\u578b\u5b89\u5168\u306b\u3088\u308b\u30e1\u30ea\u30c3\u30c8\u3082\u4eab\u53d7\u3067\u304d\u307e\u3059\u3002<\/strong><\/span><\/p>\n<p>\u578b\u306b\u3088\u308b\u5b89\u5168\u6027\u3068\u3001\u81ea\u7531\u6027\u306e\u3044\u3044\u3068\u3053\u53d6\u308a\u3092\u76ee\u6307\u3057\u305fJava\u306e\u6587\u6cd5\u3068\u3044\u3046\u308f\u3051\u3067\u3059\u306d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"Java\u306f\u3001\u578b\u3092\u5fc5\u305a\u5ba3\u8a00\u3059\u308b\u578b\u304c\u53b3\u683c\u306a\u8a00\u8a9e\u3060\u3068\u3088\u304f\u8a00\u308f\u308c\u307e\u3059\u3088\u306d\u3002 \u305d\u3082\u305d\u3082\u3001\u578b\u306e\u5b58\u5728\u7570\u8b70\u3084\u3001\u30e1\u30ea\u30c3\u30c8\u3063\u3066\u306a\u3093\u3067\u3057\u3087\u3046\u304b\u3002 \u578b\u306e\u30e1\u30ea\u30c3\u30c8 int\u578b\u306b\u306f\u3001int\u3001String\u306b\u306f\u6587\u5b57\u5217\u3068\u3044\u3046\u3088\u3046\u306b\u300c\u683c\u7d0d\u3059\u308b\u30c7\u30fc\u30bf\u306b\u5236\u7d04\u3092\u304b [&hellip;]","protected":false},"author":1,"featured_media":2087,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/2063"}],"collection":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2063"}],"version-history":[{"count":23,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/2063\/revisions"}],"predecessor-version":[{"id":20244,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/posts\/2063\/revisions\/20244"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=\/wp\/v2\/media\/2087"}],"wp:attachment":[{"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2063"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2063"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.code-magagine.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2063"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}