{"id":3825,"date":"2019-02-01T15:50:14","date_gmt":"2019-02-01T07:50:14","guid":{"rendered":"http:\/\/www.xttblog.com\/?p=3825"},"modified":"2019-02-01T15:50:14","modified_gmt":"2019-02-01T07:50:14","slug":"%e4%bb%8e%e8%bf%87%e5%b9%b4%e5%96%9d%e9%85%92%e4%b8%ad%ef%bc%8c%e6%88%91%e9%87%8d%e6%96%b0%e9%a2%86%e6%82%9f%e5%88%b0%e4%ba%86-java-%e4%b8%ad%e7%9a%84%e6%b3%9b%e5%9e%8b%ef%bc%81","status":"publish","type":"post","link":"https:\/\/www.xttblog.com\/?p=3825","title":{"rendered":"\u4ece\u8fc7\u5e74\u559d\u9152\u4e2d\uff0c\u6211\u91cd\u65b0\u9886\u609f\u5230\u4e86 Java \u4e2d\u7684\u6cdb\u578b\uff01"},"content":{"rendered":"<p>\n\t\u6211\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5458\uff0c\u5982\u5047\u5305\u6362\u3002\u4f60\u770b\u6211\u8fde\u8fc7\u5e74\u559d\u9152\u90fd\u60f3\u7740 Java\uff01\n<\/p>\n<p>\n\t<img decoding=\"async\" alt=\"\u559d\u9152\u90fd\u60f3\u7740 Java \u7684\u7a0b\u5e8f\u5458\uff01\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/wx1.sinaimg.cn\/large\/8fa5dcfcgy1fzqxqbpolzj20dw06b3yk.jpg\" style=\"width: 500px;height: 227px\" \/>\n<\/p>\n<p>\n\t\u542c\u8bf4\u559d\u9152\u90fd\u60f3\u7740 Java \u7684\u7a0b\u5e8f\u5458\u4e0d\u662f\u4e00\u4e2a\u597d\u7a0b\u5e8f\u5458\uff01\u90a3\u6211\u5c31\u7ed9\u5927\u5bb6\u8bc1\u660e\u4e00\u4e0b\uff0c\u6211\u5bf9\u6cdb\u578b\u7684\u7406\u89e3\u6709\u6ca1\u6709&ldquo;\u63ba\u9152&rdquo;\u3002\n<\/p>\n<h2>\n\t\u4ec0\u4e48\u662f\u6cdb\u578b\uff1f<br \/>\n<\/h2>\n<p>\n\t\u8fd9\u4e2a\u7f51\u4e0a\u6709\u5f88\u5bf9\u5b9a\u4e49\uff0c\u4f46\u662f\u90fd\u4e0d\u597d\u7406\u89e3\u3002\u7b80\u5355\u7684\u6765\u8bf4\uff0c\u5c31\u662f&ldquo;\u7c7b\u578b\u53c2\u6570\u5316&rdquo;\uff0c\u6216\u8005\u8bf4\u662f&ldquo;\u53c2\u6570\u5316\u7c7b\u578b&rdquo;\u3002\n<\/p>\n<p>\n\t\u5c31\u662f\u8bf4\u8fd9\u4e2a\u7c7b\u578b\uff0c\u6211\u5728\u64b8\u4ee3\u7801\u7684\u65f6\u5019\uff0c\u5e76\u4e0d\u80fd\u786e\u5b9a\u3002\u5c31\u628a\u8fd9\u4e2a\u7c7b\u578b\u7ed9\u53c2\u6570\u5316\uff0c\u8fd9\u6837\u5c31\u76f8\u5f53\u4e8e\u4f60&ldquo;\u4f20\u9012\u7ed9\u5b83\u4e00\u4e2a\u4ec0\u4e48\u53c2\u6570\uff0c\u5b83\u5c31\u662f\u4ec0\u4e48\u7c7b\u578b&rdquo;\uff01\n<\/p>\n<p>\n\t\u8fd9\u53e5\u8bdd\u6709\u70b9\u5938\u5f20\uff0c\u63cf\u8ff0\u4e0d\u662f\u7279\u522b\u6070\u5f53\u548c\u51c6\u786e\u3002\u90a3\u5c31\u770b\u6211\u559d\u9152\u7684\u65f6\u5019\u60f3\u5230\u7684\u3002\n<\/p>\n<p>\n\t\u6bd4\u5982\uff0c\u8fd9\u4e2a\u9152\u676f\uff0c\u5b83\u5728\u751f\u4ea7\u7684\u65f6\u5019\uff0c\u5e76\u4e0d\u77e5\u9053\u6211\u5c06\u6765\u7528\u6765\u559d\u9152\uff0c\u8fd8\u662f\u559d\u996e\u6599\uff0c\u559d\u767d\u5f00\u6c34\uff0c\u559d\u8336\u90fd\u6709\u53ef\u80fd\u3002\u800c\u4e14\u5c31\u662f\u7528\u6765\u88c5\u9152\uff0c\u6211\u4e5f\u80fd\u7528\u6765\u88c5\u767d\u9152\u3001\u5564\u9152\u3001\u7ea2\u9152\u3001\u9ec4\u9152\u7b49\u9152\u3002\n<\/p>\n<p>\n\t\u5728\u6bd4\u5982\uff0c\u6211\u4eec\u7684\u809a\u5b50\uff0c\u751f\u4e0b\u6765\u7684\u65f6\u5019\u5e76\u4e0d\u77e5\u9053\uff0c\u6211\u4eec\u80fd\u5403\u4ec0\u4e48\u4e0d\u80fd\u5403\u4ec0\u4e48\u3002\u53ea\u6709\u5728\u4f60\u7528\u6765\u5403\uff0c\u88c5\u4e1c\u897f\u7684\u65f6\u5019\u3002\u624d\u77e5\u9053\uff0c\u8fd9\u4e2a\u809a\u5b50\u80fd\u88c5\u9152\uff0c\u90a3\u4e2a\u809a\u5b50\u80fd\u88c5\u8089\u3002\n<\/p>\n<p>\n\t\u8fd9\u5c31\u662f\u6cdb\u578b\uff0c\u751f\u4ea7\u5236\u9020\u7684\u65f6\u5019\uff0c\u6211\u4eec\u5e76\u4e0d\u77e5\u9053\u5c06\u6765\u4f1a\u7528\u6765\u88c5\u4ec0\u4e48\uff1f\u53ea\u6709\u8c03\u7528\u8005\u660e\u786e\u3002\n<\/p>\n<p>\n\t\u90a3\u4e48\u4e00\u53e5\u8bdd\u6765\u603b\u7ed3\u4e00\u4e0b\uff1a\u6cdb\u578b\u5176\u5b9e\u5c31\u662f\u5728\u5b9a\u4e49\u7c7b\u3001\u63a5\u53e3\u3001\u65b9\u6cd5\u7684\u65f6\u5019\u4e0d\u5c40\u9650\u5730\u6307\u5b9a\u67d0\u4e00\u79cd\u7279\u5b9a\u7c7b\u578b\uff0c\u800c\u8ba9\u7c7b\u3001\u63a5\u53e3\u3001\u65b9\u6cd5\u7684\u8c03\u7528\u8005\u6765\u51b3\u5b9a\u5177\u4f53\u4f7f\u7528\u54ea\u4e00\u79cd\u7c7b\u578b\u7684\u53c2\u6570\u3002\n<\/p>\n<h2>\n\t\u6cdb\u578b\u7684\u4f7f\u7528\u573a\u666f\u6709\u54ea\u4e9b\uff1f<br \/>\n<\/h2>\n<p>\n\t\u8fd9\u4e5f\u662f\u4e00\u4e2a\u95ee\u9898\uff0c\u5f88\u591a\u4eba\u7406\u89e3\u6cdb\u578b\u3002\u4f46\u662f\u4f60\u95ee\u4ed6\uff0cJava \u4e2d\u6cdb\u578b\u9664\u4e86\u96c6\u5408\uff1aMap\u3001List\u3001Set \u7b49\uff0c\u5e73\u65f6\u5de5\u4f5c\u4e2d\u8fd8\u6709\u54ea\u4e9b\u5730\u65b9\u9002\u5408\u7528\u6cdb\u578b\uff1f\n<\/p>\n<p>\n\t\u4f60\u56de\u7b54\uff1a&ldquo;JDK \u96c6\u5408\uff0cFuture&lt;T&gt;\uff0cWeakReference&lt;T&gt;\uff0cClass&lt;T&gt;&rdquo;\u7b49\u3002\n<\/p>\n<p>\n\t\u4f60\u8981\u8fd9\u6837\u56de\u7b54\uff0c\u6211\u771f\u4e0d\u6ee1\u610f\uff01\u6211\u60f3\u95ee\u7684\u662f\uff0c\u54ea\u4e9b\u573a\u666f\u9700\u8981\u7528\u5230\u6cdb\u578b\uff0c\u800c\u4e0d\u662f\u54ea\u4e9b\u5730\u65b9\u4f7f\u7528\u7684\u662f\u6cdb\u578b\uff1f\u8fd9\u662f\u4e24\u4e2a\u95ee\u9898\u3002\n<\/p>\n<p>\n\t\u90a3\u4e48\u5230\u5e95\u6709\u54ea\u4e9b\u573a\u666f\u9002\u5408\u5462\uff1f\u6211\u7b80\u5355\u5217\u4e3e\u4e86\u4e00\u4e0b\u3002\n<\/p>\n<ul>\n<li>\n\t\t\u7ea6\u675f\u5bf9\u8c61\u7c7b\u578b\u7684\u573a\u666f\uff0c\u5b9a\u4e49\u8fb9\u754c\uff08T extends &#8230;\uff09\u7684\u5730\u65b9\u3002\n\t<\/li>\n<li>\n\t\t\u7528\u6237\u5e0c\u671b\u8fd4\u56de\u4ed6\u81ea\u5b9a\u4e49\u7c7b\u578b\u7684\u8fd4\u56de\u503c\u573a\u666f\uff0c\u6bd4\u5982 Json \u8f6c Java Bean\u3002\n\t<\/li>\n<li>\n\t\t\u5728\u7528\u53cd\u5c04\u7684\u5e94\u7528\u4e2d\uff0c\u4e5f\u7ecf\u5e38\u4f1a\u7528\u5230\u6cdb\u578b\uff0c\u5982 Class&lt;T&gt;\u3002\n\t<\/li>\n<\/ul>\n<p>\n\t\u5176\u4ed6\u7684\uff0c\u5173\u4e8e\u7c7b\u578b\u64e6\u9664\u3001\u6cdb\u578b\u901a\u914d\u7b26\u3001\u6709\u754c\u7c7b\u578b\u7b49\u6211\u5c31\u4e0d\u5199\u8bf4\u4e86\uff0c\u5177\u4f53\u53ef\u4ee5\u53c2\u8003\u6211\u7684\u8fd9\u7bc7\u6587\u7ae0\u300a<a href=\"https:\/\/www.xttblog.com\/?p=3468\" name=\"\u80fd\u8ba9\u4f60\u9762\u8bd5\u5230\u5d29\u6e83\u7684 interface \u6cdb\u578b\u53ca\u7ee7\u627f\u5173\u7cfb\" target=\"_blank\" title=\"\u80fd\u8ba9\u4f60\u9762\u8bd5\u5230\u5d29\u6e83\u7684 interface \u6cdb\u578b\u53ca\u7ee7\u627f\u5173\u7cfb\">\u80fd\u8ba9\u4f60\u9762\u8bd5\u5230\u5d29\u6e83\u7684 interface \u6cdb\u578b\u53ca\u7ee7\u627f\u5173\u7cfb<\/a>\u300b\u3002\n<\/p>\n<p>\n\t\u6700\u540e\u8bf4\u4e00\u4e0b\uff0c\u6cdb\u578b\u7684 PECS \u539f\u5219\u3002the producing list \u4f7f\u7528 extends\uff0c\u7b80\u79f0\uff1aPE\uff1b\u800c the consuming list \u4f7f\u7528 super\uff0c\u7b80\u79f0\uff1aCS\u3002\u8fd9\u5c31\u662f PECS \u539f\u5219\u3002\n<\/p>\n<p>\n\t\u7b80\u5355\u8bf4\uff0c\u5c31\u662f\u4e0b\u9762 4 \u53e5\u8bdd\uff01\n<\/p>\n<ul>\n<li>\n\t\t\u53ea\u7528\u4e8e&ldquo;\u8bfb&rdquo;\u529f\u80fd\u65f6\uff0c\u6cdb\u578b\u7ed3\u6784\u4f7f\u7528&lt;? extends T&gt;\n\t<\/li>\n<li>\n\t\t\u53ea\u7528\u4e8e&ldquo;\u5199&rdquo;\u529f\u80fd\u65f6\uff0c\u6cdb\u578b\u7ed3\u6784\u4f7f\u7528&lt;? super T&gt;\n\t<\/li>\n<li>\n\t\t\u5982\u679c\u65e2\u7528\u4e8e&ldquo;\u5199&rdquo;\uff0c\u53c8\u7528\u4e8e&ldquo;\u8bfb&rdquo;\u64cd\u4f5c\uff0c\u90a3\u4e48\u76f4\u63a5\u4f7f\u7528&lt;T&gt;.\n\t<\/li>\n<li>\n\t\t\u5982\u679c\u64cd\u4f5c\u4e0e\u6cdb\u578b\u7c7b\u578b\u65e0\u5173\uff0c\u90a3\u4e48\u4f7f\u7528&lt;?&gt;\n\t<\/li>\n<\/ul>\n<h2>\n\t\u53c2\u8003\u8d44\u6599<br \/>\n<\/h2>\n<ul>\n<li>\n\t\t<a href=\"https:\/\/www.oracle.com\/technetwork\/cn\/articles\/java\/juneau-generics-2255374-zhs.html\" name=\"\u6cdb\u578b\uff1a\u5de5\u4f5c\u539f\u7406\u53ca\u5176\u91cd\u8981\u6027\" target=\"_blank\" title=\"\u6cdb\u578b\uff1a\u5de5\u4f5c\u539f\u7406\u53ca\u5176\u91cd\u8981\u6027\">\u6cdb\u578b\uff1a\u5de5\u4f5c\u539f\u7406\u53ca\u5176\u91cd\u8981\u6027<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=3468\" name=\"\u80fd\u8ba9\u4f60\u9762\u8bd5\u5230\u5d29\u6e83\u7684 interface \u6cdb\u578b\u53ca\u7ee7\u627f\u5173\u7cfb\" target=\"_blank\" title=\"\u80fd\u8ba9\u4f60\u9762\u8bd5\u5230\u5d29\u6e83\u7684 interface \u6cdb\u578b\u53ca\u7ee7\u627f\u5173\u7cfb\">\u80fd\u8ba9\u4f60\u9762\u8bd5\u5230\u5d29\u6e83\u7684 interface \u6cdb\u578b\u53ca\u7ee7\u627f\u5173\u7cfb<\/a>\n\t<\/li>\n<li>\n\t\t<a href=\"https:\/\/www.xttblog.com\/?p=944\" name=\"\u770b\u770b\u5404\u5927\u7f51\u53cb\u5bf9Interface\u63a5\u53e3\u7684\u7406\u89e3\u7684\u795e\u56de\u590d\" target=\"_blank\" title=\"\u770b\u770b\u5404\u5927\u7f51\u53cb\u5bf9Interface\u63a5\u53e3\u7684\u7406\u89e3\u7684\u795e\u56de\u590d\">\u770b\u770b\u5404\u5927\u7f51\u53cb\u5bf9Interface\u63a5\u53e3\u7684\u7406\u89e3\u7684\u795e\u56de\u590d<\/a>\n\t<\/li>\n<\/ul>\n<!-- <audio autoplay=\"autoplay\" height=\"100\" width=\"100\" hidden=\"true\"><source src=\"https:\/\/c.coka.la\/orAvPR.mp3\" type=\"audio\/mp3\"\/><\/audio><img decoding=\"async\" src=\"https:\/\/images.weserv.nl\/?url=https:\/\/ws3.sinaimg.cn\/large\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/> --><p><!-- <img decoding=\"async\" src=\"https:\/\/raw.githubusercontent.com\/xmt1139057136\/xttblog\/master\/8fa5dcfcgy1g4em3rzar5j20ib089ae0.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/>--><img decoding=\"async\" src=\"https:\/\/saas.51autoparts.cn\/api\/admin\/sys-file\/oss\/file?fileName=84db51f8561e448f9a4fda2eff0811f9.jpg\" alt=\"\u4e1a\u4f59\u8349\u516c\u4f17\u53f7\"\/><\/p><p>\u6700\u540e\uff0c\u6b22\u8fce\u5173\u6ce8\u6211\u7684\u4e2a\u4eba\u5fae\u4fe1\u516c\u4f17\u53f7\uff1a\u4e1a\u4f59\u8349\uff08yyucao\uff09\uff01<b>\u53ef\u52a0\u4f5c\u8005\u5fae\u4fe1\u53f7\uff1a<font color=\"red\">xttblog2<\/font>\u3002\u5907\u6ce8\uff1a\u201c1\u201d\uff0c\u6dfb\u52a0\u535a\u4e3b\u5fae\u4fe1\u62c9\u4f60\u8fdb\u5fae\u4fe1\u7fa4\u3002\u5907\u6ce8\u9519\u8bef\u4e0d\u4f1a\u540c\u610f\u597d\u53cb\u7533\u8bf7\u3002<\/b>\u518d\u6b21\u611f\u8c22\u60a8\u7684\u5173\u6ce8\uff01\u540e\u7eed\u6709\u7cbe\u5f69\u5185\u5bb9\u4f1a\u7b2c\u4e00\u65f6\u95f4\u53d1\u7ed9\u60a8\uff01\u539f\u521b\u6587\u7ae0\u6295\u7a3f\u8bf7\u53d1\u9001\u81f3532009913@qq.com\u90ae\u7bb1\u3002\u5546\u52a1\u5408\u4f5c\u4e5f\u53ef\u6dfb\u52a0\u4f5c\u8005\u5fae\u4fe1\u8fdb\u884c\u8054\u7cfb\uff01<\/p><p>\u672c\u6587\u539f\u6587\u51fa\u5904\uff1a<a href=\"https:\/\/www.xttblog.com\">\u4e1a\u4f59\u8349<\/a>\uff1a &raquo; <a href=\"https:\/\/www.xttblog.com\/?p=3825\">\u4ece\u8fc7\u5e74\u559d\u9152\u4e2d\uff0c\u6211\u91cd\u65b0\u9886\u609f\u5230\u4e86 Java \u4e2d\u7684\u6cdb\u578b\uff01<\/a><\/p><!-- <div class=\"bd-reward-stl\"><button id=\"bdRewardBtn\"><span><\/span><\/button><\/div> -->","protected":false},"excerpt":{"rendered":"<p>\u6211\u662f\u4e00\u4e2a\u7a0b\u5e8f\u5458\uff0c\u5982\u5047\u5305\u6362\u3002\u4f60\u770b\u6211\u8fde\u8fc7\u5e74\u559d\u9152\u90fd\u60f3\u7740 Java\uff01 \u542c\u8bf4\u559d\u9152\u90fd\u60f3\u7740 Java \u7684\u7a0b\u5e8f\u5458\u4e0d\u662f\u4e00\u4e2a\u597d\u7a0b\u5e8f [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[1915,1916,69,794,792],"class_list":["post-3825","post","type-post","status-publish","format-standard","hentry","category-yyzt","tag-extends","tag-interface","tag-java","tag-super","tag-792"],"_links":{"self":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3825","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3825"}],"version-history":[{"count":1,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3825\/revisions"}],"predecessor-version":[{"id":3827,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=\/wp\/v2\/posts\/3825\/revisions\/3827"}],"wp:attachment":[{"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xttblog.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}