{"id":157660,"date":"2020-09-10T07:57:18","date_gmt":"2020-09-09T23:57:18","guid":{"rendered":"http:\/\/4563.org\/?p=157660"},"modified":"2020-09-10T07:57:18","modified_gmt":"2020-09-09T23:57:18","slug":"java-%e6%b3%9b%e5%9e%8b%e7%9a%84%e8%bf%99%e5%87%a0%e7%a7%8d%e5%86%99%e6%b3%95%e6%9c%89%e5%95%a5%e5%8c%ba%e5%88%ab","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=157660","title":{"rendered":"Java \u6cdb\u578b\u7684\u8fd9\u51e0\u79cd\u5199\u6cd5\u6709\u5565\u533a\u522b?"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  Java \u6cdb\u578b\u7684\u8fd9\u51e0\u79cd\u5199\u6cd5\u6709\u5565\u533a\u522b?               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : zhanglintc <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e0b\u9762\u8fd9\u4e9b\u5199\u6cd5\u7f16\u8bd1\u90fd\u6ca1\u95ee\u9898, \u6709\u5565\u5177\u4f53\u7684\u533a\u522b\u5417?<\/p>\n<pre><code>List&lt;Integer&gt; res1 = new ArrayList&lt;Integer&gt;(); List&lt;Integer&gt; res2 = new ArrayList&lt;&gt;(); List&lt;Integer&gt; res3 = new ArrayList();  List res4 = new ArrayList&lt;Integer&gt;(); List res5 = new ArrayList&lt;&gt;(); List res6 = new ArrayList(); <\/code><\/pre>\n<p>\u76ee\u524d\u77e5\u9053\u7684, res2 \u5e94\u8be5\u662f 1.7 \u4ee5\u540e, res1 \u5199\u6cd5\u7684\u7b80\u7565, \u6240\u4ee5\u4e8c\u8005\u5e94\u8be5\u662f\u4e00\u6837\u7684.<\/p>\n<p>\u90a3 res3 \u548c res2 \u6709\u533a\u522b\u4e48?<\/p>\n<p>res4 ~ res6 \u770b\u8d77\u6765\u6ca1\u6709\u4efb\u4f55\u6cdb\u578b\u7684\u6548\u679c, \u7279\u522b\u662f res4 \u4f9d\u7136\u662f\u53ef\u4ee5\u6dfb\u52a0 String \u7c7b\u578b\u7684\u5143\u7d20\u7684:<\/p>\n<pre><code>res4.add(\"abc\"); <\/code><\/pre>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"3360664\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zhanglintc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u534a\u5929\u4e86, \u8fde\u4e2a\u6253\u9171\u6cb9\u7684\u4eba\u90fd\u6ca1\u6709\u4e48&#8230; \u8fd9\u95ee\u9898\u662f\u592a\u9ebb\u70e6\u4e86, \u8fd8\u662f\u592a\u65e0\u804a\u4e86? &#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360665\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : EXChen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @zhanglintc \u662f\u7684\uff0c4-6 \u8fd9\u79cd\u5199\u6cd5\u662f\u6709\u98ce\u9669\u7684\uff0c\u56e0\u4e3a\u4f60\u53ef\u4ee5\u5f80 list \u91cc\u9762\u5b58\u4e00\u4e9b\u4e0d\u662f\u4f60\u9884\u671f\u7684\u7c7b\u578b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360666\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lxk11153 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u9009\u62e9 res2                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360667\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xgfan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u592a\u65e0\u804a\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360668\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xgfan <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             3\uff0c\u6ca1\u6709\u4ec0\u4e48\u5f71\u54cd\uff0c\u6700\u597d\u4e0d\u8981\u8fd9\u6837\u505a\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360669\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : lxk11153 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             var res1 = new ArrayList&lt;Integer&gt;(); \u600e\u4e48\u6837 [doge]                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360670\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : jasonding <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u59cb\u7ec8\u4f7f\u7528\u7b2c\u4e00\u79cd\u5199\u6cd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360671\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vate32 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             List res4 \u8fd9\u79cd\u5b9a\u4e49\u53d8\u91cf\u548c new ArrayList()\u8fd9\u79cd\u65b0\u5efa\u5bf9\u8c61\u65b9\u5f0f\uff0c\u6ca1\u6709\u5c16\u62ec\u53f7\u662f\u5386\u53f2\u539f\u56e0\uff0c\u6ca1\u6709\u6307\u5b9a\u6cdb\u578b\u7c7b\u578b\uff0c\u73b0\u5728\u5df2\u7ecf\u975e\u5e38\u4e0d\u63a8\u8350\u8fd9\u4e48\u5199\u4e86\uff0c\u5982\u679c\u4f7f\u7528\u7684\u8bdd idea \u90fd\u4f1a\u8b66\u544a\u3002\u5728 java8 \u7684\u73af\u5883\u4e0b\u63a8\u8350\u4f7f\u7528 List&lt;Integer&gt; res2 = new ArrayList&lt;&gt;()\u8fd9\u79cd\u65b9\u5f0f\uff0cnew ArrayList&lt;&gt;()\u8fd9\u4e2a\u5c16\u62ec\u53f7\u5185\u7684\u7c7b\u578b\u662f\u7701\u7565\u4e86\uff0c\u56e0\u4e3a\u7b49\u53f7\u5de6\u8fb9\u5df2\u7ecf\u6709\u4e86\uff0c\u4f1a\u8fdb\u884c\u7c7b\u578b\u63a8\u65ad\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"3360672\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : zhanglintc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @vate32 #8 \u55ef, \u76ee\u524d\u770b\u6765 List&lt;Integer&gt; res2 = new ArrayList&lt;&gt;(); \u662f\u6700\u7b80\u5355\u800c\u4e14\u6ca1\u6709\u95ee\u9898\u7684\u5199\u6cd5.<br \/>\u5176\u5b9e res3 \u6211\u611f\u89c9\u9664\u4e86\u6709\u4e2a\u8b66\u544a\u5916, \u597d\u50cf\u4e5f\u6ca1\u95ee\u9898. \u5f53\u7136\u4e86, \u6211\u4e0d\u4f1a\u8fd9\u4e48\u5199\u7684.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>Java \u6cdb\u578b\u7684\u8fd9\u51e0\u79cd\u5199\u6cd5\u6709\u5565\u533a\u522b&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/157660"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=157660"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/157660\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=157660"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=157660"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=157660"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}